|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
regex questionwhat is a good regex expression for remove html <img ....> tag?
I tried "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) but it is not quite working thank you for your time Why not simply "<img[^>]>"?
GS wrote: Show quoteHide quote > what is a good regex expression for remove html <img ....> tag? > I tried > "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) > but it is not quite working > > thank you for your time > > thanks for replying. However I found this worked better for me
myregex = New Regex("<img .*?(>|(/>|(</img>))", RegexOptions.IgnoreCase Or RegexOptions.ExplicitCapture) It does not gobble up other tags fooling the <img .....> on the same line. it also supposed to take care of xml also Credit is due to Dave Sexton for helping arriving at the above expression Show quoteHide quote "Göran Andersson" <gu***@guffa.com> wrote in message news:e5DKUuM5GHA.3840@TK2MSFTNGP06.phx.gbl... > Why not simply "<img[^>]>"? > > GS wrote: > > what is a good regex expression for remove html <img ....> tag? > > I tried > > "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) > > but it is not quite working > > > > thank you for your time > > > > There is never ever an ending tag for the img tag, and even if there
were, your pattern doesn't handle that. GS wrote: Show quoteHide quote > thanks for replying. However I found this worked better for me > > myregex = New Regex("<img .*?(>|(/>|(</img>))", > RegexOptions.IgnoreCase Or > RegexOptions.ExplicitCapture) > It does not gobble up other tags fooling the <img .....> on the same line. > it also supposed to take care of xml also > > Credit is due to Dave Sexton for helping arriving at the above expression > > "Göran Andersson" <gu***@guffa.com> wrote in message > news:e5DKUuM5GHA.3840@TK2MSFTNGP06.phx.gbl... >> Why not simply "<img[^>]>"? >> >> GS wrote: >>> what is a good regex expression for remove html <img ....> tag? >>> I tried >>> "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) >>> but it is not quite working >>> >>> thank you for your time >>> >>> > > So far I have not seem ending tag for <img ..> at least for html.
although I think I have sees some comments of XML <img tags and <object tags both have ending tags of sorts I did made mistake in thr regex for the ending tag by leaving out one right paranthesis myregex = New Regex("<img .*?(>|(/>)|(</img>))", Show quoteHide quote "Göran Andersson" <gu***@guffa.com> wrote in message news:OqhvAdX5GHA.1248@TK2MSFTNGP03.phx.gbl... > There is never ever an ending tag for the img tag, and even if there > were, your pattern doesn't handle that. > > GS wrote: > > thanks for replying. However I found this worked better for me > > > > myregex = New Regex("<img .*?(>|(/>|(</img>))", > > RegexOptions.IgnoreCase Or > > RegexOptions.ExplicitCapture) > > It does not gobble up other tags fooling the <img .....> on the same line. > > it also supposed to take care of xml also > > > > Credit is due to Dave Sexton for helping arriving at the above expression > > > > "Göran Andersson" <gu***@guffa.com> wrote in message > > news:e5DKUuM5GHA.3840@TK2MSFTNGP06.phx.gbl... > >> Why not simply "<img[^>]>"? > >> > >> GS wrote: > >>> what is a good regex expression for remove html <img ....> tag? > >>> I tried > >>> "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) > >>> but it is not quite working > >>> > >>> thank you for your time > >>> > >>> > > > > GS wrote:
> So far I have not seem ending tag for <img ..> at least for html. Yes, but XML is a completely different thing. There the tag name "img" > > although I think I have sees some comments of XML <img tags and <object tags > both have ending tags of sorts has no special meaning at all. > I did made mistake in thr regex for the ending tag by leaving out one right It still doesn't handle the ending tag, if there ever was one. As the > paranthesis > > myregex = New Regex("<img .*?(>|(/>)|(</img>))", starting tag ends with ">" that will be caught instead of the ending tag. Show quoteHide quote > > "Göran Andersson" <gu***@guffa.com> wrote in message > news:OqhvAdX5GHA.1248@TK2MSFTNGP03.phx.gbl... >> There is never ever an ending tag for the img tag, and even if there >> were, your pattern doesn't handle that. >> >> GS wrote: >>> thanks for replying. However I found this worked better for me >>> >>> myregex = New Regex("<img .*?(>|(/>|(</img>))", >>> RegexOptions.IgnoreCase Or >>> RegexOptions.ExplicitCapture) >>> It does not gobble up other tags fooling the <img .....> on the same > line. >>> it also supposed to take care of xml also >>> >>> Credit is due to Dave Sexton for helping arriving at the above > expression >>> "Göran Andersson" <gu***@guffa.com> wrote in message >>> news:e5DKUuM5GHA.3840@TK2MSFTNGP06.phx.gbl... >>>> Why not simply "<img[^>]>"? >>>> >>>> GS wrote: >>>>> what is a good regex expression for remove html <img ....> tag? >>>>> I tried >>>>> "<img [/:.a-z =0-9\""_;&]*\->", RegexOptions.IgnoreCase) >>>>> but it is not quite working >>>>> >>>>> thank you for your time >>>>> >>>>> >>> > >
Are optional parameters really an advisable thing to use ?
keypressed Setting breakpoints in VB2005 Truly transparent label. How to find the position of the first dash in a string Iterate a structure to get name and value Converting a string to a Form object JavaScript, ASP, and VB :) Looking for a real working transparent picturebox (newbie -vb2005) going back to begin of file with StreamReader |
|||||||||||||||||||||||