Reputation: 117
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 class [35]
matches both 35=
and 53=
.
How can I achieve an exact match for a character class?
Any suggestions, or different approaches are very much appreciated!
Upvotes: 0
Views: 1147
Reputation: 33252
to match 35= followed by one or two alphanumeric char you can use
35=\w{1,2}
Felix
Upvotes: 1