Reputation: 977
I want to check whether the given string includes "test_icon_<integer>"
. the integer could be 10 or 22 or 32 or 109 or 120.( first integer can't be zero but second and third digits can be zero)
Following strings are not accepted
1."test_icon_<1a>"
2."test_icon_<1.1>"
3. "test_icon_<!@q>"
4. "test_icon_<abced>"
Please help me to solve this.
Upvotes: 0
Views: 76
Reputation: 41838
This regex matches your strings and fails on the bad ones:
test_icon_<[1-9]\d{0,2}>
see demo.
Explain Regex
test_icon_< # 'test_icon_<'
[1-9] # any character of: '1' to '9'
\d{0,2} # digits (0-9) (between 0 and 2 times
# (matching the most amount possible))
> # '>'
Upvotes: 1
Reputation: 646
Following regex should solve your problem:
/test_icon_\<[0-9]+\>/
Hope this helps :)
Upvotes: 0