unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Regexp to match 't' in a nested list?
Date: Thu, 12 Sep 2013 22:46:47 +0530	[thread overview]
Message-ID: <874n9qj6yo.fsf@gmail.com> (raw)
In-Reply-To: <87ioy60y6v.fsf@gmail.com> (Thorsten Jolitz's message of "Thu, 12 Sep 2013 19:03:36 +0200")


\_<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.



  reply	other threads:[~2013-09-12 17:16 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 [this message]
2013-09-12 17:41   ` Thorsten Jolitz

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=874n9qj6yo.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tjolitz@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).