Skip to main content
December 11, 2008
Question

Regex help

  • December 11, 2008
  • 1 reply
  • 401 views
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 has been closed for replies.

1 reply

Inspiring
December 12, 2008
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
BKBK
Community Expert
Community Expert
December 14, 2008
You could just begin the regex with http, like this:

December 14, 2008
Thank you very much BKBK and Mack, both solutions were a lot of help.