Ignoring a xml Tag in the middle of the file in Regex (with non capturing group ?)

Posted by schmirrwurst on Stack Overflow See other posts from Stack Overflow or by schmirrwurst
Published on 2013-10-18T07:54:30Z Indexed on 2013/10/18 9:55 UTC
Read the original article Hit count: 99

Filed under:
|
|

I have an xml with an embeded tag, and I would like to capture everthing but the FType Tags... in python regex.

<xml>
<EType>
<E></E>
<F></F>
<FType><E1></E1><E2></E2></FType>
<FType><E1></E1><E2></E2></FType>
<FType><E1></E1><E2></E2></FType>
<G></G>
</EType>
</xml>

I tried :

(?P<xml>.*(?=<FType>.*<FType>).*)

But it give me everything ;-(

I Expect :

<xml>
<EType>
<E></E>
<F></F>
<G></G>
</EType>
</xml>

© Stack Overflow or respective owner

Related posts about python

Related posts about Xml