Forum Discussion
DaveC_21078
Altostratus
Sep 01, 2009string map is replacing ? with a space
Hi,
I'm doing a string map and the first ? after ad.imp in the replacement string is being replaced with a space. Strings below. How do I stop that?
string map "adserver/impression/pid=$pid/oid=$oid/rand=$rand/?click ad.imp?pid=$pid&oid=$oid&rand=$rand/?pclk"
Thanks
3 Replies
- David_Remington
Employee
string map uses glob-style pattern matching which means that ? is a special character meaning "any one character". If you need to match a literal ? you need to escape it:
string map "adserver/impression/pid=$pid/oid=$oid/rand=$rand/\?click ad.imp\?pid=$pid&oid=$oid&rand=$rand/\?pclk"
The same would be true of * [ and ]
http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm - hoolio
Cirrostratus
Hi David,
I think string match uses glob style matching, but I'm not sure about string map:
% string map "a?c def" abc
abc
% string map "a*c def" abc
abc
% string map "a?c def" a?c
def
% string map "a?c d?f" a?c
d?f
Aaron - DaveC_21078
Altostratus
The /worked. Thanks.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
