+ 6
Why showing Match 2 while there 'A' is exists in string.
import re pattern = r"[^A-Z]" if re.search(pattern, "this is all quiet"): print("Match 1") if re.search(pattern, "AbCdEfG123"): print("Match 2") if re.search(pattern, "THISISALLSHOUTING"): print("Match 3") Output Match 1 Match 2
2 Respostas
+ 4
"pattern" tells that some match is found if some not-capital character is present: that's the case of Match1 and Match2.
If you want to see all matching characters, you can use findall():
https://code.sololearn.com/c932mkueVaai/?ref=app
+ 2
There are non-capital alphabets and numbers in the second option.