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

Regex help

Guest
Dec 11, 2008 Dec 11, 2008

Copy link to clipboard

Copied

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

Views

336

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

You could just begin the regex with http, like this:

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Documentation