Reputation: 11
I have this data:
<div><b>CANADA INC.</b></div>
I want to remove everything between <>
and the <>
itself.
I want it to look like:
CANADA INC.
Can I use RegEx to do the trick?
Upvotes: 0
Views: 37
Reputation: 5596
First of all, note that you should not really use RegEx to parse HTML. You should see if the language you are using supports parsing HTML, or maybe find a plugin to so do it.
Now we have that over and done with, there are 2 ways of doing this:
<[^>]*>
How it works:
< # Opening <
[^>]* # Any character except a > any number of times
> # Closing >
<.*?>
How it works:
< # Opening <
.* # Any character any number of times
? # Make sure the expression is not greedy (and select the entire string)
> # Closing >
Upvotes: 1