Forum Discussion
boneyard
May 06, 2012MVP
checking string on occurrence of characters
im looking for a way to check if a string contains any of these 4 characters: { } [ ] (might add more later). tried this with scan, but somehow it doesn't want to work, i can find the character but im missing a way to differentiate between a hit and not.
is there another function to try? findstr might be an option but ill end up with doing it 4 times then right?
the string which has to be checked can be pretty much anything:
[
]
[]
hi[bye]test
[something]
[[[[]]][[[]
- hooleylistCirrostratusI'm not sure how to use a ] in a string match character set. This works for a [:
if { [scan $string {%*[^][{}]%[][{}]%*s} match] == 1 || [scan $string {%[][{}]%*s} match]} { found $match } else { no match }
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