I'm trying to learn to use regex and can't get the following to work quite right: <ns\w+)>.*<ns:\1> with the following malformed xml: <ns:enc><ns:td>third</ns:td><ns:enc> If it's on the same line (no line feeds, returns) it works (it will find the entire line, which is what I want). Note: I'm trying to find the matching malformed closing ns:enc. Any help? The unhappy face is supposed to be a : followed by a (
<ns\w+)>.*<ns:\1>[code] that works if the xml is all on one line like: [code]<ns:enc><ns:td>third</ns:td><ns:enc>[code] It will match the entire line (like I want). However, if the xml is: [code]<ns:enc> <ns:td>third</ns:td> <ns:enc>[code] as you would expect (each node on a separate line), it does not match. Code (markup):