If you don't manage to get what you're after. Just loop over the array and
look for the string.

Adrian

-----Original Message-----
From: cf coder
Sent: 15 February 2008 17:11
To: CF-Talk
Subject: regex help


Hello everybody,

I need some help with regular expressions.

I'm trying to write a reqular expression that will return all the links on a
page that contain a string in the query string.

I found a UDF on cflib that returns a list of all the anchor tags on a page
but I want to only return all href tags that contain the word "ProductID" in
the query string ex:
<a href="somesite.com/index.cfm?action=get&productID=1">test</a>

Here is the udf, that returns all the links on the page.

function hrefsToList(inputString) {
        var pos=1;
        var tmp=0;
        var linklist = "";
        var delimiter = ",";
        var endpos = "";

        if(arrayLen(arguments) gte 2) delimiter = arguments[2];

        while(1) {
                tmp = reFindNoCase("<a[^>]*>[^>]*</a>", inputString, pos);
                if(tmp) {
                        pos = tmp;
                        endpos = findNoCase("</a>", inputString, pos)+4;
                        linkList = listAppend(linkList, mid(inputString, pos, 
endpos-pos),
delimiter);
                        pos = endpos;
                }
                else break;
        }

        return linkList;
}

Can someone please show me how to change the modify expression to return
what I've explained above please?

Thanks,
cfcoder


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299084
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to