1

For example, i try to search and delete in an XML file all node wp:postmeta who has different content

    <wp:postmeta>
        <wp:meta_key>_edit_last</wp:meta_key>
        <wp:meta_value><![CDATA[2]]></wp:meta_value>
    </wp:postmeta>

I'll try first something like : <wp:postmeta>*</wp:postmeta> thinking that it will return all the node. But it doesn't work. What is the methodology for that sort of search ? Thx

jcbaudot
  • 60
  • 7

1 Answers1

1
<wp:postmeta>[\s\S]*?</wp:postmeta>

Try this.See demo.

http://regex101.com/r/sA8iT4/2

vks
  • 67,027
  • 10
  • 91
  • 124
  • I works with only on node. And I want to delete all the tag in my long long file... – jcbaudot Nov 30 '14 at 19:55
  • @jcbaudot You need to use `g` or `global` flag for that.Apply the flag – vks Nov 30 '14 at 19:56
  • Thank you. I'll try, but it only work when I delete the new line escape see here : http://regex101.com/r/sA8iT4/1 PS.Regex is difficult to learn.. – jcbaudot Nov 30 '14 at 20:08
  • 1
    Amazing ! It's magic. Now I try to understand the regex for next time. Thank you ! – jcbaudot Nov 30 '14 at 20:12