473,396 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

regex question

GS
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
Sep 28 '06 #1
5 2937
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

Sep 30 '06 #2
GS
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.comwrote in message
news:e5**************@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

Oct 1 '06 #3
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.comwrote in message
news:e5**************@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


Oct 1 '06 #4
GS
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>))",
"Göran Andersson" <gu***@guffa.comwrote in message
news:Oq**************@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.comwrote in message
news:e5**************@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


Oct 2 '06 #5
GS wrote:
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
Yes, but XML is a completely different thing. There the tag name "img"
has no special meaning at all.
I did made mistake in thr regex for the ending tag by leaving out one right
paranthesis

myregex = New Regex("<img .*?(>|(/>)|(</img>))",
It still doesn't handle the ending tag, if there ever was one. As the
starting tag ends with ">" that will be caught instead of the ending tag.
>
"Göran Andersson" <gu***@guffa.comwrote in message
news:Oq**************@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.comwrote in message
news:e5**************@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
>
>

Oct 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: engwar1 | last post by:
Not sure where to ask this. Please suggest another newsgroup if this isn't the best place for this question. I'm new to both vb.net and regex. I need a regular expression that will validate what...
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
2
by: Tim Conner | last post by:
Hi, Thanks to Peter, Chris and Steven who answered my previous answer about regex to split a string. Actually, it was as easy as create a regex with the pattern "/*-+()," and most of my string...
6
by: Du Dang | last post by:
Text: ===================== <script1> ***stuff A </script1> ***more stuff <script2> ***stuff B
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
5
by: Chris | last post by:
How Do I use the following auto-generated code from The Regulator? '------------------------------------------------------------------------------ ' <autogenerated> ' This code was generated...
6
by: Martin Evans | last post by:
Sorry, yet another REGEX question. I've been struggling with trying to get a regular expression to do the following example in Python: Search and replace all instances of "sleeping" with "dead"....
7
by: Extremest | last post by:
I am using this regex. static Regex paranthesis = new Regex("(\\d*/\\d*)", RegexOptions.IgnoreCase); it should find everything between parenthesis that have some numbers onyl then a forward...
6
by: Phil Barber | last post by:
I am using Regex to validate a file name. I have everything I need except I would like the dot(.) in the filename only to appear once. My question is it possible to allow one instance of character...
6
by: | last post by:
Hi all, Sorry for the lengthy post but as I learned I should post concise-and-complete code. So the code belows shows that the execution of ValidateAddress consumes a lot of time. In the test...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.