What regex should be applied when selecting text between unknown XML tags but not the tags themselves?

StackOverflow https://stackoverflow.com/questions/23368260

  •  12-07-2023
  •  | 
  •  

Pregunta

As the title suggests e.g.

<unknownTag>Select this only</unknownTag>
<anotherUnknownTag>Select this too</anotherUnknownTag>

To select: - Select this only - Select this too

A brief explanation on separate parts would be nice too if possible.

¿Fue útil?

Solución

You can use this regex.

(?!<.+?>)([^<>]+?)(?=</.+?>)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top