This snippet will parse a variable called file and create a list with
all URLs called lURL (pipe delimited)

<cfscript>
regexp = 'href[[:space:]]*=[[:space:]]*"[^"]"';
cnt = REFindNoCase(regexp,file,1,"yes");
while (cnt.pos[1] GT 0) {
        text = mid(tmpvar,cnt.pos[2],cnt.len[2]);
        text = ListLast(text,"/");
        // the next if is only required if you dont want duplicate urls
        if(NOT ListFind(lURL,text,"|"))
                lURL = ListAppend(lURL,text,"|");
        cnt = REFindNoCase(variables.regexp,tmpvar,cnt.pos[2],"yes");
}
</cfscript>

-----Original Message-----
From: Shawn Grover [mailto:[EMAIL PROTECTED]]
Sent: dinsdag 29 januari 2002 19:10
To: CF-Talk
Subject: Another RegEx question


I find myself needing to find all the HREF values on a given page.
Regular
Expressions are the answer, but I haven't nailed the pattern yet.
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to