all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Regexp to match 't' in a nested list?
@ 2013-09-12 17:03 Thorsten Jolitz
  2013-09-12 17:16 ` Jambunathan K
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-09-12 17:03 UTC (permalink / raw)
  To: help-gnu-emacs


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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Regexp to match 't' in a nested list?
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Jambunathan K @ 2013-09-12 17:16 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Regexp to match 't' in a nested list?
  2013-09-12 17:16 ` Jambunathan K
@ 2013-09-12 17:41   ` Thorsten Jolitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-09-12 17:41 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-12 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.