Lisp HUG Maillist Archive

Regexp repeating characters

Hi LispHug,

The LispWorks documentation notes that "The regular expression syntax used is similar to that of Emacs."  I'm not getting the expected result for repeated characters, however.

The Emacs Lisp equivalent I would reckon is:

(string-match   "1\\{3\\}"   "0111")
--> 1



But in LWW6 I cannot seem to find the right pattern syntax:

CL-USER 3 > (find-regexp-in-string   "1\\{3\\}"   "0111")
NIL
NIL

CL-USER 4 > (find-regexp-in-string   "1\{3\}"   "0111")
NIL
NIL


Gosh, what am I overlooking?  Thanks.

Brian Connoy


Re: Regexp repeating characters

According to the manual (Section 3.2.1.2 of the Editor reference, which documents the regex syntax supported) it does not support {}. Take a look at cl-ppcre for that.

    -tree

On Wed, Aug 17, 2011 at 2:09 PM, Brian Connoy <BConnoy@morrisonhershfield.com> wrote:

Hi LispHug,

The LispWorks documentation notes that "The regular expression syntax used is similar to that of Emacs."  I'm not getting the expected result for repeated characters, however.

The Emacs Lisp equivalent I would reckon is:

(string-match   "1\\{3\\}"   "0111")
--> 1



But in LWW6 I cannot seem to find the right pattern syntax:

CL-USER 3 > (find-regexp-in-string   "1\\{3\\}"   "0111")
NIL
NIL

CL-USER 4 > (find-regexp-in-string   "1\{3\}"   "0111")
NIL
NIL


Gosh, what am I overlooking?  Thanks.

Brian Connoy




--
Tom Emerson
tremerson@gmail.com
http://treerex.blogspot.com/

RE: Regexp repeating characters

Thank you sir.  I really should read more carefully!

 

BC

 

From: Tom Emerson [mailto:tremerson@gmail.com]
Sent: Wednesday, August 17, 2011 2:16 PM
To: Brian Connoy
Cc: Lisp Hug Lispworks (lisp-hug@lispworks.com)
Subject: Re: Regexp repeating characters

 

According to the manual (Section 3.2.1.2 of the Editor reference, which documents the regex syntax supported) it does not support {}. Take a look at cl-ppcre for that.

    -tree

On Wed, Aug 17, 2011 at 2:09 PM, Brian Connoy <BConnoy@morrisonhershfield.com> wrote:


Hi LispHug,

The LispWorks documentation notes that "The regular expression syntax used is similar to that of Emacs."  I'm not getting the expected result for repeated characters, however.

The Emacs Lisp equivalent I would reckon is:

(string-match   "1\\{3\\}"   "0111")
--> 1



But in LWW6 I cannot seem to find the right pattern syntax:

CL-USER 3 > (find-regexp-in-string   "1\\{3\\}"   "0111")
NIL
NIL

CL-USER 4 > (find-regexp-in-string   "1\{3\}"   "0111")
NIL
NIL


Gosh, what am I overlooking?  Thanks.

Brian Connoy




--
Tom Emerson
tremerson@gmail.com
http://treerex.blogspot.com/

Updated at: 2020-12-10 08:37 UTC