Re: Second Try - Regex Question
- From: Spam Catcher <spamhoneypot@xxxxxxxxxx>
- Date: Sun, 31 Dec 2006 09:14:00 GMT
"Just Me" <news.microsoft.com> wrote in news:u1kfspELHHA.3552
@TK2MSFTNGP03.phx.gbl:
I need a regex to do this.
Ignore < possibleWhiteSpace htmlTag
Replace whitespace anything >
With >
Basically I need to remove anything following the html tag up to and
including the closing tag
Any help is appreciated.
Hmmm are you trying to do this?
< TAG > becomes < TAG>?
You can try this to match the entire tag (and the parts within the tag):
\<(?<leading>\s)*(?<tag>\w)+(?<trailing>\s)*\>
The regex above uses named groups so that you can references parts of
the matches in code. Take a look at RegEx.Match.Groups for details.
If you want to do pure search, replace, this should work:
RegEx.Replace(MyHTML, "(\s)*\>", ">")
(\s)+ matches zero or more spaces. \> matches the trailing tag.
I hope that's what you want.
.
- Follow-Ups:
- Re: Second Try - Regex Question
- From: Just Me
- Re: Second Try - Regex Question
- References:
- Second Try - Regex Question
- From: Just Me
- Second Try - Regex Question
- Prev by Date: Re: When to use AndAlso vs And ?
- Next by Date: Re: Regex question
- Previous by thread: Second Try - Regex Question
- Next by thread: Re: Second Try - Regex Question
- Index(es):
Relevant Pages
|