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
  •  | 
  •  

Pergunta

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.

Foi útil?

Solução

You can use this regex.

(?!<.+?>)([^<>]+?)(?=</.+?>)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top