regex how to define that the rule must be the same -
i searching number in format.
[0-9]{3,6}[\-\/]{1}[0-9]{1,3}[\-\/]{1}[0-9]{1,2}
is there way how define there should slash/ or colom- ? in other words, option first 1 - , second 1 / should omitted.
yes, can use \1
back-reference. matches same character (or group) first matching group. in case, ([-\/])
first matching group , \1
requires same character.
[0-9]{3,6}([-\/])[0-9]{1,3}\1[0-9]{1,2}
here example: https://regex101.com/r/mkxnun/1
Comments
Post a Comment