What is the regex for defining the following pattern?
Note that 1) I do not want to miss the string "position"
when it is alone and not accompanied by the rest of string and 2) "somenumber"
is any 1 or 2 digit whole number which can be zero or positive, and 3) "somesubstring"
can be any single English letter or a combination of alphabets and/or digits).
"position_somenumber_somesubstring"
CodePudding user response:
I'm not entirely sure I understand the first part of your question, but if I do, then this should do the trick:
/position_\d{1,2}_\w $/
You can play around with it and see the explanation in this link: https://regex101.com/r/xV1hKO/1