[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to translate `rx' expressions to `rx-to-string'?
From: |
Thorsten Jolitz |
Subject: |
How to translate `rx' expressions to `rx-to-string'? |
Date: |
Thu, 31 Jul 2014 16:37:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi List,
this works fine
#+begin_src emacs-lisp
(format "%S"
(rx bol "foo_" (+ word) eol))
#+end_src
#+results:
: "^foo_[[:word:]]+$"
but its surprisingly difficult to translate it to `rx-to-string':
#+begin_src emacs-lisp
(format "%S"
(rx-to-string (list 'bol "foo_" '(+ word) 'eol)))
#+end_src
-> rx-form: Unknown rx form `bol'
When just using a string
#+begin_src emacs-lisp
(format "%S"
(rx "foo_"))
#+end_src
#+results:
: "foo_"
this is ok, but different:
#+begin_src emacs-lisp
(format "%S"
(rx-to-string "foo_"))
#+end_src
#+results:
: "\\(?:foo_\\)"
And this
#+begin_src emacs-lisp
(format "%S"
(rx-to-string (list "foo_" '+ 'word)))
#+end_src
or this
#+begin_src emacs-lisp
(format "%S"
(rx-to-string (list "foo_" '(+ word))))
#+end_src
both result in -> rx-form: Unknown rx form `foo_'
This works
#+begin_src emacs-lisp
(format "%S"
(rx-to-string "foo_" '(+ word)))
#+end_src
#+results:
: "foo_"
but ignores everything after the string.
Seems I did not get the syntax for function rx-to-string yet - any hints
would be welcome.
--
cheers,
Thorsten
- How to translate `rx' expressions to `rx-to-string'?,
Thorsten Jolitz <=