From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: Regexp to match 't' in a nested list? Date: Thu, 12 Sep 2013 19:41:21 +0200 Message-ID: <87a9ji0wfy.fsf@gmail.com> References: <87ioy60y6v.fsf@gmail.com> <874n9qj6yo.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1379007879 30777 80.91.229.3 (12 Sep 2013 17:44:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Sep 2013 17:44:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 12 19:44:41 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VKAvt-0005UI-Qm for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 19:43:57 +0200 Original-Received: from localhost ([::1]:43084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKAvt-0007sd-6k for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Sep 2013 13:43:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKAvb-0007sR-SG for help-gnu-emacs@gnu.org; Thu, 12 Sep 2013 13:43:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKAvU-0002Mx-H9 for help-gnu-emacs@gnu.org; Thu, 12 Sep 2013 13:43:39 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:55177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKAvU-0002Mt-AI for help-gnu-emacs@gnu.org; Thu, 12 Sep 2013 13:43:32 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VKAuI-0003eY-Th for help-gnu-emacs@gnu.org; Thu, 12 Sep 2013 19:42:18 +0200 Original-Received: from e178062143.adsl.alicedsl.de ([85.178.62.143]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Sep 2013 19:42:18 +0200 Original-Received: from tjolitz by e178062143.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Sep 2013 19:42:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178062143.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:QzQt+4kZojf3a8Jr50YZO5mb/2w= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93356 Archived-At: Jambunathan K writes: > \_ > > 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 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