help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexp to match 't' in a nested list?


From: Thorsten Jolitz
Subject: Re: Regexp to match 't' in a nested list?
Date: Thu, 12 Sep 2013 19:41:21 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Jambunathan K <address@hidden> writes:

> \_<t\_>
>
> See (info "(elisp) Regexp Backslash")

Great, that works, thank you ... why did I never look at that manual
page? Maybe without a practical use case at hand that section looks a
bit too esoteric...

> Thorsten Jolitz <address@hidden> 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.
>
>

-- 
cheers,
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]