Dup Goto 📝

RegularExpressions

PT2/lang/python/modules python re 02-21 09:46:27
To Pop
10 lines, 44 words, 234 chars Wednesday 2024-02-21 09:46:27

Gotchas

When you want a flag like m, you need to include a count:

a = re.sub(f,r,0,re.M)

rather than just

a = re.sub(f,r,re.M)

as the latter takes the integer value of re.M and uses that as the replacement count.