It depends on what the parameters look like.
The general form for the regular expression will be:
\[{something which matches parameter names}\]
If the parameter names can only contain letters, digits and underscores, then you will want something like:
\[\w+\]
This will match parameter names which contain at least one letter, digit or underscore. For example:
[parameter]
[parameter1]
[1st_parameter]
[10]
[a]
[_]
A more usual limitation is to accept parameter names which contain at least one letter, digit or underscore, but must start with a letter:
\[[a-zA-Z]\w*\]
Examples include:
[parameter]
[parameter1]
[first_parameter]
[a]
but it will not match:
[1st_parameter]
[10]
[_]
However, you might decide that it should match anything between square brackets, and that anything can be a parameter name (maybe you want to validate parameter names at a later stage)
\[[^]]+\]
will match anything between square brackets so long as it contains at least 1 character.
If you also want to allow empty square brackets (i.e. match []
) then you will want:
\[[^]]*\]