Question
I am trying to get a
FormattedSearch to create a news listing. The idea is to use TWiki's News-Icon
%N% as a tag, so I try to run a regex SEARCH for the pattern. But either text replacement resolves the pattern before sending it to grep or grep returns an error.
Any of the used patterns seem to work using grep directly. We are using
GnuWin32-grep in Windows 2000 Professional. Here are some of the various versions I tried and their results.
%SEARCH{"%N%" scope="text" web="all" type="regex"}%
Searched: <img src="/twiki/pub/TWiki/TWikiDocGraphics/new.gif
%SEARCH{"$percntN$percnt" scope="text" web="all" type="regex"}%
Searched: $percntN$percnt
%SEARCH{"%N%" scope="text" web="all" type="regex"}%
Could not perform search. Error was: c:/PROGRA~1/GnuWin32/bin/grep -E -i -l -H -- %TOKEN|U% %FILES|F% Grep for '%N%' returned error
%SEARCH{"[%]N[%]" scope="text" web="all" type="regex"}%
Could not perform search. Error was: c:/PROGRA~1/GnuWin32/bin/grep -E -i -l -H -- %TOKEN|U% %FILES|F% Grep for '[%]N[%]' returned error
%SEARCH{"\%N\%" scope="text" web="all" type="regex"}%
Could not perform search. Error was: c:/PROGRA~1/GnuWin32/bin/grep -E -i -l -H -- %TOKEN|U% %FILES|F% Grep for '\%N\%' returned error
I am not sure how to interpret the errors. Is it the pattern causing an error or are the two options
%TOKEN|U% %FILES|F% faulty - they seem to be uninterpreted parts. The latter would suggest a problem within the search perl package with the percent sign.
Is there actually a bug, then how may I fix it, or is there a way to escape the percent sign properly?
Or am I missing something really obvious..?
Environment
--
PhilippSGeisler - 29 May 2008
Answer
If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
That last one worked for me, and it works here too (below).
I'm using GnuWin32 as well, but the grep string in that error seems to be non-standard. What do you have for the following 'configure' settings (my values are shown, morphed into your path):
- {RCS}{SearchAlgorithm} = TWiki::Store::SearchAlgorithms::Forking
- {RCS}{EgrepCmd} = c:/PROGRA~1/GnuWin32/bin/grep -E %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%
- {RCS}{FgrepCmd} = c:/PROGRA~1/GnuWin32/bin/grep -F %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%
Searched: \%N\%
The Central Processing Unit (CPU) used by the Atari 2600 is a 6507, a 6502 with a limited addressing capability. The 6507 is an 8 bit processor. AndrewDavie 13 ...
%N% Business Systems and Risk Team %X% This page is under construction %TOC% What do we do? Our role within the Sustainable Industries Division is to ...
Calculation for expire functionality. See source code. %STARTINCLUDE%%N%%STOPINCLUDE%
Number of topics: 3
--
SeanCMorgan - 29 May 2008
Thanks for your answer.
These are my settings:
- {RCS}{SearchAlgorithm} TWiki::Store::SearchAlgorithms::Forking
- {RCS}{EgrepCmd} c:/PROGRA~1/GnuWin32/bin/grep -E %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%
- {RCS}{FgrepCmd} c:/PROGRA~1/GnuWin32/bin/grep -F %CS{|-i}% %DET{|-l}% -H -- %TOKEN|U% %FILES|F%
There seems to be no difference...
--
PhilippSGeisler - 30 May 2008
Indeed they are the same.
What do you get with
"grep -V"? I used the Windows installer for TWiki, so mine says,
grep (GNU grep) 2.5.1.
--
SeanCMorgan - 31 May 2008
It's
grep (GNU grep) 2.4.2.
We are currently moving the TWiki installation from Windows to Linux, where there'll be the
proper grep version 2.5.3, so I hope the problem will get resolved on it's own by this move.
I'll keep you updated and will eventually close the question.
--
PhilippSGeisler - 02 Jun 2008
Problem has been resolved by moving to Ubuntu Linux with
GNU grep 2.5.3. Thank you for your help.
--
PhilippSGeisler - 02 Jun 2008