[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp to match 't' in a nested list?
From: |
Jambunathan K |
Subject: |
Re: Regexp to match 't' in a nested list? |
Date: |
Thu, 12 Sep 2013 22:46:47 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
\_<t\_>
See (info "(elisp) Regexp Backslash")
Thorsten Jolitz <tjolitz@gmail.com> writes:
> Hi List,
>
> for making Emacs Lisp talk to PicoLisp, I have to upcase t and nil (T
> and NIL in PicoLisp) in nested lists that contain all kinds of strings
> and keywords in possibly many languages. Using the more difficult 't'
> case as example, so far I came up with this regexp that doesn't seem to
> give false positives:
>
> ,------------------------------------------
> | "\\( t \\|(t \\| t)\\|(t)\\|^t \\| t$\\)"
> `------------------------------------------
>
> (same thing for nil, just replace t with nil)
>
> But the regexp misses at least one case: a string like
>
> ,----------------
> | " t t nil nil "
> `----------------
>
> will be converted to
>
> ,----------------
> | " T t NIL nil "
> `----------------
>
> I cannot find a solution for this case that does not immediately results
> in false positives when applied to a string like
>
> ,------------------------------------------------
> | " t t nil nil total albanil nilonga tat mitat "
> `------------------------------------------------
>
> Any tips/hints would be appreciated.