Re: regex help

2008-02-15 Thread Jason Morgan
EDIT:

The regex should be this one instead.  The one above would not handle any thing 
between the href= and the closing . 

(a[^]*href=['](([^']*)?([^']ProductID=?([^']*)[^']*))['][^]*([^]*)\/a)
 

~|
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:299105
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: regex help

2008-02-15 Thread Jason Morgan
Hi here is a regex that should do the job.  It does a little more that you are 
asking for.  I felt like playing around with the regex.  

cfsavecontent 
variable=regex(a[^]*href=['](([^']*)?([^']ProductID=?([^']*)[^']*))[']([^]*)\/a)/cfsavecontent


cfsavecontent variable=text
a style=mystyle:as; href=index.cfm?x=1ProductID=5y=2I am link 1/abr 
/

a href=index.cfm?x=1z=5y=2I am link 2/abr /

a href=index.cfm?ProductID=1z=5y=2I am link 3/abr /

a href=index.cfm?x=1z=5ProductID=2I am link 4/abr /

a href=index.cfm?x=1ProductIDy=2I am link 5/abr /

/cfsavecontent

fieldset
legendText/legend

cfoutput#text#/cfoutput

/fieldset

cfset result = ReFindNoCase(regex,text,1,true) /
cfset resultArray = ArrayNew(1) /


cfloop condition=#result[len][1]# neq 0
cfset info = StructNew() /
cfset info.match = Mid(text,result[pos][2], result[len][2]) /
cfset info.href= Mid(text,result[pos][3], result[len][3]) /
cfset info.hrefbeforeProductID= Mid(text,result[pos][4], 
result[len][4]) /
cfset info.hreffromProductIDPlus = Mid(text,result[pos][5], 
result[len][5]) /
cfset info.ProductID = Mid(text,result[pos][6], result[len][6]) /
cfset info.LinkText = Mid(text,result[pos][7], result[len][7]) /
cfset ArrayAppend(resultArray, info) /
cfset text = removeChars(text,result[pos][1], result[len][1]) /

cfset result = ReFindNoCase(regex,text,1,true) /
/cfloop

cfdump var=#resultArray#


Thanks, 
Jason Morgan. 

~|
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:299100
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4