0
its correct in python rex?
pattern = r"[1-5][0-9]" if re.search(pattern,"100"): print("Match 1") it supposed Any two-digit number from 10 to 59, but it matches with 100, why?
3 Respuestas
+ 2
Because search() method will seach inside the provided string... do instead:
pattern = r"^[1-5]\d#x27;
\d is for digit (same as class [0-9])
^ at start stand for start of string
$ at end stand for end of string
0
I think you need to specify that you are only looking for 2 digits.
Something like:
pattern = r"[1-5][0-9]quot;
That way your regex will know that and end of line is expected after the second digit.
Also, I think something like this might work as well:
pattern = r"]d\dquot; - the "translation" would be : digit digit endOfLine
0
Which regex would match "email@domain.com"?