all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Regexp to match 't' in a nested list?
Date: Thu, 12 Sep 2013 19:41:21 +0200	[thread overview]
Message-ID: <87a9ji0wfy.fsf@gmail.com> (raw)
In-Reply-To: 874n9qj6yo.fsf@gmail.com

Jambunathan K <kjambunathan@gmail.com> 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 <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.
>
>

-- 
cheers,
Thorsten




      reply	other threads:[~2013-09-12 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 17:03 Regexp to match 't' in a nested list? Thorsten Jolitz
2013-09-12 17:16 ` Jambunathan K
2013-09-12 17:41   ` Thorsten Jolitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9ji0wfy.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.