lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexp Functions


From: Aaron Hill
Subject: Re: Regexp Functions
Date: Tue, 09 Jun 2020 10:58:04 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-06-09 9:25 am, Michael Gerdau wrote:
[sent this earlier and forgot to include the list...]

That definition helps.     I use the Guile manual, the section Regular
Expressions is miss leading about what is there.    I only went there
because Arron Hill told me about it     And the introduction states "A
full description of regular expressions and their syntax is beyond the
scope of this manual"; and the URL goes nowhere.   And I would guess
knowing what to read elsewhere that is consistent with the guile
version Lilypond uses may be a probleblen.   I am open to a good ron
cryptic reference?

I personally really like the perlre manpage. It is THE reference for
all Perl Regular Expressions from which many other current regexp
engines are derived.

Just be aware that Guile uses GNU's version of POSIX extended regular expressions (ERE), which is significantly more limited than Perl-compatible regular expressions (PCRE).

GNU adds some features beyond the core POSIX standard, such as shorthands for word characters (\w) and whitespace (\s). But it omits the one for digits (\d) that is included in PCRE. Instead, one must use either /[0-9]/ or /[[:digit:]]/, the latter being an example of a POSIX character class.

GNU ERE includes support for the {,n} quantifier that matches an item between zero and n times; however, quantifiers in POSIX ERE are always greedy, whereas PCRE supports lazy and possessive variants.

POSIX ERE permits only basic unnamed capturing groups, although GNU ERE does add support for backreferences: /.(.)(.)\2\1/ will match 'xyzzy'. However, PCRE additionally handles non-capturing groups, named groups, and many forms of lookarounds and conditionals.


-- Aaron Hill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]