Escaping backslashes in append operation for use in regex
Posted: Thu Aug 04, 2005 3:52 pm
I have a small issue getting a regex to work the way I want it to. I set a string to the following:
And then I want to alternate through the command line options by comparing against a list of flags that I'm looking for. Say:
So I want to do the following:
However I don't get a match because the append takes out the "\" before the s & w. when I try to escape the "\" I get "\\s" or "\\w", which also does not match. So my question is, how can I escape a backlash for an append to output only a singular "\"?
Thanks in advance,
--maq
Code: Select all
(set 'command-line "woot -r 45 -w 46")
Code: Select all
(set 'opts '("r" "w"))
Code: Select all
(dolist (o opts)
(if (find (append "-" o "\s*(\w*)(\s*-|$)") command-line 0)
(do-something with $1)
)
)
Thanks in advance,
--maq