Application Development and Automation 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: 
Read only

REGEX problem

vneecious
Product and Topic Expert
Product and Topic Expert
0 Likes
1,270

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
Read only

Former Member
0 Likes
1,216

Try using

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

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

4 REPLIES 4
Read only

Former Member
0 Likes
1,217

Try using

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

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

Read only

vneecious
Product and Topic Expert
Product and Topic Expert
0 Likes
1,216

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

Read only

vneecious
Product and Topic Expert
Product and Topic Expert
0 Likes
1,216

Simplifying your answer:

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

Read only

Former Member
0 Likes
1,216

Another option that's more greedy.

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