Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

REGEX problem

vneecious
Advisor
Advisor
0 Kudos

Hello, everyone!

I need a regular expression that matches every text that is not part of the XML tag. I found the regex below, which works perfectly in any online regex validator, but when i test it in DEMO_REGEX_TOY an error occurs.

(?<=^|>)[^><]+?(?=<|$)

Everything indicates that the problem is in ' <= '. There is another way to make it work?

i'll appreciate if someone help me.

[]'s

Vinicius

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try using

: REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>'

I tried this on regex toy and it work for me.

4 REPLIES 4

Former Member
0 Kudos

Try using

: REPLACE ALL OCCURRENCES OF REGEX '<[a-zA-Z\/][^>]*>'

I tried this on regex toy and it work for me.

0 Kudos

much more simple than search for the content between the tags! thank you 😉

0 Kudos

Simplifying your answer:

REPLACE ALL OCCURRENCES OF REGEX '<[^<]+>' WITH space

former_member197445
Contributor
0 Kudos

Another option that's more greedy.

REPLACE ALL OCCURRENCES OF REGEX '\<(.*?)\>' WITH space