I'm trying to remove the following from a string
Any occurance of
<br> </br> <br clear="all"> <br/> <br />
Here's my string
<br></br><br clear="all">Hel lo bright girl<br/><br /></br>
I am trying the .net regex like this
and it just doesn't work the way I think it should! I wind up with the following string: <b><h1>
and that's it!
What is wrong with my syntax?
Here's my thinking
< is the literal
\/? escapes the / so I am looking for 0 or 1 / (forward slash)
br is a literal string because I'm looking for "br"
.* I am looking for 0 to many of any character
> the closing literal
I've tried all kinds of combinations - and get close...
The following pattern works pretty well: "<\/?br\W*>"
I get the following string:
<b><h1><br clear="all">Hel lo bright girl</h1></b>
For some reason, however, it misses the <br clear="all">
Any occurance of
<br> </br> <br clear="all"> <br/> <br />
Here's my string
<br></br><br clear="all">Hel lo bright girl<br/><br /></br>
I am trying the .net regex like this
Code:
sLine = System.Text.RegularExpressions.Regex.Replace(sLine, "<\/?br.*>", String.Empty, RegularExpressions.RegexOptions.IgnoreCase)
and that's it!
What is wrong with my syntax?
Here's my thinking
< is the literal
\/? escapes the / so I am looking for 0 or 1 / (forward slash)
br is a literal string because I'm looking for "br"
.* I am looking for 0 to many of any character
> the closing literal
I've tried all kinds of combinations - and get close...
The following pattern works pretty well: "<\/?br\W*>"
I get the following string:
<b><h1><br clear="all">Hel lo bright girl</h1></b>
For some reason, however, it misses the <br clear="all">
Comment