Forum Discussion
Robert_47833
Nov 22, 2011Altostratus
how to match 6 digtals via command except matches_regex
hi,dear irule
if {$uri matches_regex {-[0-9][0-9][0-9][0-9][0-9][0-9]}} {
pool xxx
}
I don't wanna use matches_regex any more
do u have an alternation method to achieve this...
hooleylist
Jun 12, 2012Cirrostratus
Yes, I wasn't too concerned about a URI containing non-ascii characters as HTTP URIs must contain only printable ASCII characters (and/or percent encodings of reserved characters). Here are a couple of references:
http://en.wikipedia.org/wiki/Internationalized_domain_name
http://stackoverflow.com/questions/2504564/can-http-uris-have-non-ascii-characters
If you did need to match only 6 0-9 characters you could use [string is numeric $chars] as 'is numeric' returns true for 999999. It wouldn't work once you surpass the limit for an integer (I think this is possibly version and platform specific). Or you could use [string is double $chars] if you want to allow decimal values as well. Or if you want to be more explicit on your matching, you could go back to a regex like [0-9]{6} to match exactly six digits or [0-9]{1,6} to match 1 to 6 digits.
Aaron
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