This question about Topic Markup Language and applications: Answered
Query search text escapes
How do you escape things when query-searching text?
Suppose I want to know all the documents of a particular type that use the
%RED%
macro in their text. This seems like a ready-made use for query searching a-la:
%SEARCH{"DocumentClass.DocumentType='Document' AND text ~ '*%RED%*'" type="query" bla bla bla...}%
Except it doesn't work!
How to escape the "%" characters in this case? Using "$percnt" doesn't work.
As a workaround you can
%SEARCH{"DocumentClass.DocumentType='Document' AND text ~ '*RED%*'" type="query" bla bla bla...}%
but that would also get
%FRED%
etc.
--
BigBaaadBob - 15 Dec 2009
Interesting question; no, $percnt won't work. I'm struggling to think of a way to do that. Logically
Number of topics: 0
ought to work.
--
CrawfordCurrie - 16 Dec 2009
Yes, I tried that (escaping with backslashes) and I agree it ought to work, but it doesn't for me. Is this a bug or a feature request?
--
BigBaaadBob - 16 Dec 2009
More an oversight. See
Tasks.Item2508. The patch is against the trunk, but the fix to Foswiki/Infix/Parser is so trivial, you may want to try applying it yourself (forget about the unit tests).
--
CrawfordCurrie - 16 Dec 2009