Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Regex help

Guest
Dec 11, 2008 Dec 11, 2008
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.
TOPICS
Advanced techniques
371
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 12, 2008 Dec 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2008 Dec 14, 2008
You could just begin the regex with http, like this:

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 14, 2008 Dec 14, 2008
LATEST
Thank you very much BKBK and Mack, both solutions were a lot of help.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources