Well, I am trying to apply some regular expression(search/replace) on xml. Yes I have to use some lib.'s but in that case I cannot. My problem is ,as you may figure out, replacing value of node with an integer. When I try that, it gives me grouping error.Here are my patterns:
search pattern:
(<fieldset>)([^>].+)(<ipadd>)([^>].+)(<value>)([^>].+)(</value>)([^>].+)(</ipadd>)([^>].+)(</fieldset>)
replace pattern:
\1\2\3\4\5123.123.123.123\7\8\9\10\11
As you see fifth group becomes "\5123" in replace pattern. And of course it doesn't work.
Well if I use something like this:
\1\2\3\4\5 123.123.123.123\7\8\9\10\11
It works. But I don't want a space or something else there.
And it also work with string:
\1\2\3\4\5foofoofoo\7\8\9\10\11
ah I am using re.sub() for replacing.
Is there a way that I can use it without spaces?
Thanks everyone