[thelist] RegEx Fun

.jeff jeff at members.evolt.org
Fri Jan 4 16:08:24 CST 2002


howdy evolters,

i need some assistance from those of you with more confidence with regular
expressions than i have.  i'm looking to create a couple that will strip
substrings from a longer string.  i have 3 patterns i'd like to match and
remove, if found.  the one caveat is that i'm using coldfusion and am
therefore limited to it's regex rules.

let's use the following strings as the examples:

/search/?keywords=studio&option=any&maxrows=10&thumbnails=1&pageresponse=Ite
m%20added&cfid=2126967&cftoken=69981973
/documents/?pageresponse=Item%20updated&cfid=2126967&cftoken=69981973
/basket/?pageresponse=Item%20removed&cfid=2126967&cftoken=69981973

in these strings, the "pageresponse" url variable could have any string of
text after it, but will always be url encoded.  in the case of any of the
strings above, i want to find instances of "&pageresponse=Item%20added",
"pageresponse=Item%20updated", or "pageresponse=Item%20removed".  this is
the first pattern i'm looking for.

the second is "?cfid=2126967" or "&cfid=2126967".  the numbers after "cfid="
are dynamic and not bound by a length, but will always be numbers.  i
*think* that's as simple as "[?|&]cfid=[0-9]*".  if somebody could tell me
if that's even close i'd appreciate it.

the final one is quite similar.  i'm looking for "?cftoken=69981973" or
"&cftoken=69981973".  the numbers after "cftoken=" are dynamic and not bound
by a length, but will always be numbers.  if my previous attempt is correct,
then i'm guessing this one would be "[?|&]cftoken=[0-9]*".

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list