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

문제

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.

도움이 되었습니까?

해결책

You can use this regex.

(?!<.+?>)([^<>]+?)(?=</.+?>)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top