0

Metacharacters

import re pattern = r"[A-Za-z][A-Za-z][0-9]" if re.search(pattern, "LS8"): print("Match 1") if re.search(pattern, "YE45"): print("Match 2") if re.search(pattern, "la9"): print("Match 3") All the codes are a match according to my output. I thought "Match 2 was not valid per the criteria i.e two alphabets and a digit. Why is it a match please

22nd Sep 2016, 2:48 PM
Godric Oscar Dolphine
Godric Oscar Dolphine - avatar
2 odpowiedzi
+ 3
Because it matches YE4 in YE45.
22nd Sep 2016, 3:51 PM
Zen
Zen - avatar
0
Thanks
13th Jan 2017, 5:04 PM
Godric Oscar Dolphine
Godric Oscar Dolphine - avatar