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.

15th Mar 2019, 9:01 AM
Yソーセージ
Yソーセージ - avatar
2 Réponses
+ 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.
15th Mar 2019, 9:12 AM
Шащи Ранжан
Шащи Ранжан - avatar
0
thanks for your explanation!
17th Mar 2019, 5:34 AM
Yソーセージ
Yソーセージ - avatar