variable in regexp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Enis

    variable in regexp

    hello,

    does anyone know how to use variables in regular expressions?

    var = '%%bob%%'

    replace = 'bob'

    var = re.sub("%%[^%%]*replace%%', 'peter', var)

    how do i have to mask the replace-variable?

    thanx


Working...