Exact match in regex character sets
Posted
by
Dominik
on Stack Overflow
See other posts from Stack Overflow
or by Dominik
Published on 2011-01-08T12:48:50Z
Indexed on
2011/01/08
12:53 UTC
Read the original article
Hit count: 323
Hi all
Consider the following string
'35=_-235-b-35=35-35=2-135=a-35=123-235=2-35=a-53=1-53=a-553=b'
I'd like to extract everything that matches 35= followed by 1 or 2 characters. What I came up with is the following regex
\d[35]=[A-Za-z0-9]{1,2}
The problem is the character set [35] matches both 35= and 53=. How can I achieve an exact match for a character set?
Any suggestions, or different approaches are very much appreciated!
© Stack Overflow or respective owner