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

Extract path from SRC in a IMG tag

Guest
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

I have a query which outputs a bunch of text with pictures in it. I'm trying to get the path from the SRC tag.

<IMG height=250 alt="" hspace=0 src="/intranet/images/files/first.jpg" width=350 border=0>

After the regex i have to get this: /intranet/images/files/first.jpg but my code throws a error constantly.

Any thoughts?

Thank you.

Flashhgordon


TOPICS
Advanced techniques

Views

519

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

correct answers 1 Correct answer

Deleted User
Jun 01, 2007 Jun 01, 2007
Works like a charm Michael... Thank you..

Votes

Translate

Translate
Advocate ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

What kind of error are you getting?

does this work any better:

ReReplaceNoCase(qGetText.EZineBody, '(<IMG [^>]* src=")([^"]+)(" [^>]*>)', \2)

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
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

I'm getting this error:

Missing argument name.
When using named parameters to a function, every parameter must have a name.
The CFML compiler was processing:

an expression beginning with "rereplacenocase", on line 9, column 19.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 9, column 2.


The error occurred in D:\websites\Intranet\test.cfm: line 9

7 :
8 :
9 : <cfset varImage = rereplacenocase(qGetText.EZineBody, '<img[^>;]*>(.+)', \1)>
10 :
11 : <cfoutput query="qGetText">#EZineBody#</cfoutput>




I tried your code but unfortunately it throws an error too (see below):

Missing argument name.
When using named parameters to a function, every parameter must have a name.
The CFML compiler was processing:

an expression beginning with "ReReplaceNoCase", on line 9, column 19.This message is usually caused by a problem in the expressions structure.
a cfset tag beginning on line 9, column 2.


The error occurred in D:\websites\Intranet\test.cfm: line 9

7 :
8 :
9 : <cfset varImage = ReReplaceNoCase(qGetText.EZineBody, '(<IMG [^>]* src=")([^"]+)(" [^>]*>)', \2)>
10 :
11 : <cfoutput query="qGetText">#EZineBody#</cfoutput>





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
Advocate ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

Have you tried adding in the scope parameter?

What happens when you try this?
<cfset varImage = ReReplaceNoCase(qGetText.EZineBody, '(<IMG [^>]* src=")([^"]+)(" [^>]*>)', "\2", "all")>

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
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

LATEST
Works like a charm Michael... Thank you..

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