Re: Wondering what I'm doing wrong?
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Tue, 9 Jun 2026 11:59:55 -0700
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
I don’t believe that Named Registers are the same thing as a Named Subpattern. But maybe I’m wrong about that? My impression from reading the source code for CL-PPCRE is that a “Register” is a thing into which locations and extents are stored. The use of parens around any pattern produces an incremental growth of unnamed registers. I have absolutely no idea how a named register would be useful. I do see references to backward references in patterns using extension systaxes like (?>, (?:, and many others. But I have no idea what these are talking about. I don’t understand the reference to AllegroCL, since it has been forever since I used AllegroCL. But… what do I know. The whole of CL-PPCRE seems predicated on the user having deep knowledge of Perl. Not sure when Perl was invented, but my education pre-dates its common use. But I do understand regular expressions as illuminated by Hopcroft and Ulman. And I have extensive ancient experience with SED, GREP, and AWK. Mostly, for the past 40 years, I have always been goal directed and just did whatever it took to achieve my goals - or else suffer along. Finally, now I can take the time to understand more deeply. So if you insist that I study Perl, so be it. > On Jun 9, 2026, at 11:25, Tim Bradshaw (as tfb at cley dot com) <[email protected]> wrote: > > Is this an RTFM problem? From TFM > > > *allow-named-registers* <> > > If this value is true (the default is NIL), CL-PPCRE will support (?<name>"<regex>")and \k<name> in regex strings to provide named registers and back-references as in AllegroCL <http://www.franz.com/support/documentation/7.0/doc/regexp.htm#regexp-new-capturing-2>. > > Isn't that what you want? > > --tim > >> On 9 Jun 2026, at 18:44, David McClain <[email protected]> wrote: >> >> Well, as I stated, I have never used Perl. But I did study Finite Automata back in the early 90’s at UofAz. >> >> And for myself, the string regexps are all I need, with the addition of named sub-patterns. The sexpr version that these compile into are presumably correct, but they denote another language for which I don’t really know all the rules. >> >> The only irritating thing I have run into with the string regexps is that to enclose a group so that you can add a +,*,or ? afterward, also causes the group to be recorded in a “register” (to use the PPCRE terminology). This is not always desired, and I can see that by using the sexpr language they could be avoided. >> >> So when I do use the sexp version, I first code up an exemplar with a string regexp pattern, and watch what comes out after calling CL-PPCRE:PARSE-STRING against it. That allows me to fumble around in the dark, and it has worked so far. >> >> But the question remains. Why has this named subpattern facility been ignored in both LW and CL-PPCRE string regexp patterns? Perl seems happy to comply with an extended syntax. Has nobody needed this except me? >> >> [one of the very first things I wrote for myself, back in 1994, was a REGEXP package using an NFA engine - and it definitely included the named subpattern facility.] >> >> >> >>> On Jun 9, 2026, at 07:52, Tim Bradshaw (as tfb at cley dot com) <[email protected]> wrote: >>> >>> On 9 Jun 2026, at 11:25, David McClain (as dbm at refined-audiometrics dot com) <[email protected]> wrote: >>>> >>>> You *can* do this by writing out CL-PPCRE parse trees by hand. But not embedded within regexp pattern strings. >>> >>> Surely this is yet another reason to use cl-ppcre's sexp syntax? Less like line noise, more flexible, and you can make it generate bits of it for you if you know the stringy thing. What's not to love? >>> >>> --tom >>> >>> _______________________________________________ >>> Lisp Hug - the mailing list for LispWorks users >>> [email protected] >>> http://www.lispworks.com/support/lisp-hug.html >> >> >> _______________________________________________ >> Lisp Hug - the mailing list for LispWorks users >> [email protected] >> http://www.lispworks.com/support/lisp-hug.html