Display full version of the post: SRXTEXT Troubles

msa81
18.11.2008, 16:06
Hi,
 
I am trying to use SRXTEXT to remove control characters from MTEXT. The colour control characters are something like this: {\\C255; or {\\C2; or just \\C2;
 
I have successfully use the regexp from the command line however I would like to construct a lisp routine but the program seems to function differently. For example.
 
entering the commands:
srxtext
r
\(.\){\\C[0-9];\(.\)
\1\2
L
A
 
will replace "texttext{\\C2;text}text" with "texttexttext}text"
 
this works correctly but if I try to do this:
 
(srxtext "Regular" "\(.\){\\C[0-9];\(.\)" "\1\2" "All")
 
it will return 0. I have managed to get the following to work
 

(srxtext "Regular" "\{\\\\C[0-9];" "###" "All")
 
which will replace {\\C2; with "###" but
 

(srxtext "Regular" "\(.\)\{\\\\C[0-9];\(.\)" "\1\2" "All")
 
will also return 0.
 
why does this not work? Could someone please point me in the right direction? thanks very much!

Vladimir Michl
18.11.2008, 16:46
Please note that LISP has its own processing of the backslash character so you have to double it again.
The right regexp for this case is:
[CODE](srxtext "Regular" "\\(.\\)\\\\C[0-9]+;\\(.\\)" "\\1\\2" "All")[/CODE]

msa81
18.11.2008, 18:18
I guess I should have realized that! Thanks very much for the quick response.

msa81
19.11.2008, 21:45
I noticed you used the "+" character. Where can I find a list of expressions that SRXTEXT supports?

Vladimir Michl
19.11.2008, 22:12
It is not any special feature of srxText but a standard Posix format of regular expressions.
 
See e.g.:
http://en.wikipedia.org/wiki/Regular_expression