1 2 3 4 5 6 7 8 9 10 11 12 13 | import re x = r'hai! \1 <ops> $1 \' \x \\' print "want to see: " print x print "getting: " print re.sub(".(.).", x, "###") print "over escaped: " print re.sub(".(.).", re.escape(x), "###") print "could work: " print re.sub(".(.).", x.replace("\\", "\\\\"), "###") |
aW1wb3J0IHJlCgp4ID0gcidoYWkhIFwxIDxvcHM+ICQxIFwnIFx4IFxcJwpwcmludCAid2FudCB0byBzZWU6ICIKcHJpbnQgeAoKcHJpbnQgImdldHRpbmc6ICIKcHJpbnQgcmUuc3ViKCIuKC4pLiIsIHgsICIjIyMiKQpwcmludCAib3ZlciBlc2NhcGVkOiAiCnByaW50IHJlLnN1YigiLiguKS4iLCByZS5lc2NhcGUoeCksICIjIyMiKQpwcmludCAiY291bGQgd29yazogIgpwcmludCByZS5zdWIoIi4oLikuIiwgeC5yZXBsYWNlKCJcXCIsICJcXFxcIiksICIjIyMiKQo=
-
upload with new input
-
result: Success time: 0.01s memory: 6680 kB returned value: 0
want to see: hai! \1 <ops> $1 \' \x \\ getting: hai! # <ops> $1 \' \x \ over escaped: hai\!\ \1\ \<ops\>\ \$1\ \\'\ \x\ \\ could work: hai! \1 <ops> $1 \' \x \\


