0
Python meta characters
pattern1 = r"[^A-Z]" pattern2 = r"^gray" I don’t understand why these " ^ " mean different. Is this because one of them is used inside [] ? Is there any other meta characters used like this? Please help me.
2 odpowiedzi
+ 6
Yep. When it's inside the square brackets, it'll match for not having what follows carate( ^ ) in the given string. In this case it'll match everything other than A-Z characters bcz of "[^A-Z]" which means not A-Z.
0
thanks for your explanation!