Monday 15 September 2014

regex - Substituting leading '+1' in Python with re module -


I'm sure it's definitely a simple and stupid question, but I'm not sure how the leading " By using the sub () module of + 1 " again module I'm trying this

  import re re.ub ("/ + 1", "", "+ 1585123456") re.sub (r "^ / + 1", " , "+ 1585123456")   

but they all return the same original string. Can anyone help me make a clear mistake I am? Thank you.

<< code> to avoid using + , /

  re.sub (r "\ + 1", "", "+ 1585123456")    

No comments:

Post a Comment