|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Second Try - Regex QuestionI 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. "Just Me" <news.microsoft.com> wrote in news:u1kfspELHHA.3552 @TK2MSFTNGP03.phx.gbl:> I need a regex to do this. Hmmm are you trying 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. < 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. parsing ""(\s)*>", ">")" - Too many )'s. // Error from regex.
[\w|\d]*=.*> This almost works, but it leaves out all the text contained by the element. Show quoteHide quote "Spam Catcher" <spamhoneypot@rogers.com> wrote in message news:Xns98AA2B08745B8usenethoneypotrogers@127.0.0.1... > "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. Done it.
[A-Za-z0-9]*=.*?>| [A-Za-z0-9]*=.*?\sp Show quoteHide quote "Just Me" <news.microsoft.com> wrote in message news:OD85cOMLHHA.1240@TK2MSFTNGP03.phx.gbl... > parsing ""(\s)*>", ">")" - Too many )'s. // Error from regex. > > > [\w|\d]*=.*> This almost works, but it leaves out all the text contained > by the element. > > > > "Spam Catcher" <spamhoneypot@rogers.com> wrote in message > news:Xns98AA2B08745B8usenethoneypotrogers@127.0.0.1... >> "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. > >
ExecuteNonQuery - problem
How to modify label.text in a dynamically generated label in VB.net Typing Markup Tags Ending in /> Forms ok in design mode, cropped in run mode, only on my monitor complie Errors question about sub New() in a class Getting values between forms Process.Start Dumb question question about returning value of a function |
|||||||||||||||||||||||