Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code multiline search and replace for HTML / XML tags? [duplicate]

How to search for a start and ending tag that may include multiple non-blank lines?

<body myattr="hello" >
  <title>Hello</title>
</body>

<element>Surprise!!!</element>

<body myattr="goodbye" >
  <title>Goodbye</title>
</body>
like image 271
Ed of the Mountain Avatar asked Jan 23 '19 21:01

Ed of the Mountain


1 Answers

Answer kindly provided to me by VS Code developer. May it help others.

Thank you @roblourens!

<body[\n\s\S]*?</body>

This is useful to replace or delete unwanted elements in XML or HTML.

like image 57
Ed of the Mountain Avatar answered Oct 12 '22 23:10

Ed of the Mountain