Skip to main content
Dec 11, 2008 9:57 AM UTC
Question

Regex help

Hello i need some help with regex to do the following

String to get:
http://www.domain.com/images/pic.jpg

String to search:
<img src=" http://www.domain.com/images/pic.jpg" width="202" height="62" />

Using the following regex expression:
<img src="([^>]*[^/]?)>

So far when i run this it grabs the following:
http://www.domain.com/images/pic.jpg" width="202" height="62" /

Any help is very much appreciated.
This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Inspiring
Dec 12, 2008 1:25 PM UTC
Mrs. Man wrote:
> Hello i need some help with regex to do the following
>
> String to get:
> http://www.domain.com/images/pic.jpg
>
> String to search:
> <img src=" http://www.domain.com/images/pic.jpg" width="202" height="62" />
>
> Using the following regex expression:
> <img src="([^>]*[^/]?)>

<img src="([^"]*)"

--
Mack
Translate
BKBK
Community Expert
Community Expert
Dec 14, 2008 5:22 PM UTC
You could just begin the regex with http, like this:

Translate
Dec 14, 2008 7:05 PM UTC
Thank you very much BKBK and Mack, both solutions were a lot of help.
Translate