This regex would search through a string and return all occurences of q=followed by any character that's NOT an &.
q=[^&]+ Given this string: http://www.google.com/search?source=ig&hl=en&rlz=&q=coldfusion&aq=f&aqi=g-p3 g7&aql=&oq=&gs_rfai=CJtNhsL9yTK_zHIWWhgTb-J3tDwAAAKoEBU_QXcSj It matches q=coldfusion q=f Not sure where the second q= came from. I just did a search on the Google homepage for "ColdFusion". andy -----Original Message----- From: Che Vilnonis [mailto:ch...@asitv.com] Sent: Monday, August 23, 2010 12:54 PM To: cf-talk Subject: RE: RegEx: Grabbing Keywords from Referers Nice solution John. Thanks! Definitely different than mine. I wonder if the regex gurus have a solution as well. ;) -----Original Message----- From: John M Bliss [mailto:bliss.j...@gmail.com] Sent: Monday, August 23, 2010 1:00 PM To: cf-talk Subject: Re: Grabbing Keywords from Referers This does (at least) Google. Shouldn't be too difficult to extrapolate the others... <cfloop index="thisarg" list="#cgi.HTTP_REFERER#" delimiters="?&"> <cfif ListFirst(thisarg, "=") is "q" and ListLen(thisarg, "=") is 2> <!--- then user searched for URLDecode(ListLast(thisarg, '=')) ---> <cfbreak> </cfif> </cfloop> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336474 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm