Forum Discussion
ramann_75062
Apr 23, 2009Nimbostratus
Regex in parameter name
Hi@all,
i have again a question about regex :-)
We have parameters like
name_1=
name_2=
...
name_9999=
...
Benjamin_9036
Apr 23, 2009Historic F5 Account
Hey Bjoern,
You can use some fairly simple patterns for wildcard entities, but none that would allow the expansion of characters you mention. You can use [list/sequence] like your example, 'name_[1-9]' but there is no way to attach a quantity to the sequence. Using 'name_[1-9]*' would simply match 'name_', a digit 1-9, then anything. Likewise, 'name_[1-9]{4}' will match 'name_', a digit, and the {4} characters literally.
If you know that the number will never reach a certain value, say 1,000, you could create multiple parameters:
'name_[1-9]', 'name_[1-9][0-9]', 'name_[1-9][0-9][0-9]'
This obviously becomes unwieldy, however, if the number has no ceiling. In that case, the more basic wildcard is still an option. Even 'name_*' or perhaps 'name_[1-9]*' to make sure the value at least begins with a number.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects