About
Pricing
Community
Teams
Start Free Trial
Log in
erikTsomik
asked on
8/17/2016
ColdFusion Rereplace
I am trying to replace some some words from the url but getting the error message Malformed regular expression "?target=(top|bottom)".
The url is
http://www.kidstuffcatalog.com/return.cfm?target=top
the CF rereplace #rereplace(cookie.lastpage
, "?target=(top|bottom)", "","ALL")#
ColdFusion Language
Web Development
Web Languages and Standards
Web Servers
3
1
Last Comment
_agx_
8/22/2022 - Mon
_agx_
8/17/2016
The "?" is a special character in regex's and needs to be escaped:
reReplaceNoCase(cookie.las
tpage, "\?target=(top|bottom)", "","ALL")
Terry Woods
8/18/2016
To explain why the error occurred, the meaning of the ? in a regex is to make the previous character or capturing group optional, which is why the pattern gives an error when the ? is the first character.
ASKER CERTIFIED SOLUTION
_agx_
8/18/2016
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
reReplaceNoCase(cookie.las