0

Is the r before the pattern definition useful?

I tried without and it works too so.. what does it change?

9th Apr 2019, 3:26 PM
Poloi 34
Poloi 34 - avatar
3 Answers
+ 2
Building re patterns you often need \. These are used for escape characters like \n in regular strings. So taking a raw string saves you from having to write too many \\.
9th Apr 2019, 3:47 PM
HonFu
HonFu - avatar
+ 1
Oh ok so when we put a r before, all the "specials" characters are disabled?
9th Apr 2019, 3:49 PM
Poloi 34
Poloi 34 - avatar
+ 1
Exactly.
9th Apr 2019, 3:53 PM
HonFu
HonFu - avatar