0

pattern = r"(.+) \1"

What exactly it do?

28th Jan 2017, 5:30 PM
Ehson Miraz
Ehson Miraz - avatar
3 Answers
+ 4
its a regular expression where .+ means one or many dots and \1 means match the exact same text that was matched by 1st group. group means written content written in parenthesis( ).
28th Jan 2017, 6:45 PM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
+ 3
'.+' in regexp means one or many characters ( the dot is the wildcard ). To match a dot, you need to escape it '\.' or to use it in a class of char: '[.]'...
29th Jan 2017, 9:20 AM
visph
visph - avatar
0
Thanks
29th Jan 2017, 6:39 AM
Ehson Miraz
Ehson Miraz - avatar