Thank you

Sent from Yahoo Mail on Android 
 
  On Sun, Feb 5, 2017 at 11:32 AM, p...@hermes.cam.ac.uk<p...@hermes.cam.ac.uk> 
wrote:   On Sun, 5 Feb 2017, Ze'ev Atlas wrote:

> On the testinput2 file, there is a pattern/(?<n>a|b|c)\g<n>*/
> Trying the same pattern in Perl (5.20 on Windows) generates the
> error Unterminated \g... pattern in regex; marked by <-- HERE in
> m/(?<n>a|b|c)\g <-- HERE <n>*/ at perltst.pl line 14.
> 
> I am not clear whether the pattern is universally legitimate or is it
> legitimate only in the context of PCRE2.  I (and would) upgrade my
> Perl, but could you please shed some light Thank you  Ze'ev Atlas

Here is the light, taken from the pcre2pattern.3 man page:

  "Absolute and relative subroutine calls"

  For compatibility with Oniguruma, the non-Perl syntax \g followed by a
  name or a number enclosed either in angle brackets or single quotes,
  is an alternative syntax for referencing a subpattern as a
  "subroutine". Details are discussed later. Note that \g{...} (Perl
  syntax) and \g<...> (Oniguruma syntax) are *not* synonymous. The
  former is a back reference; the latter is a subroutine call.

In other words, it's a PCRE2 (and also PCRE1) thing.

Philip

-- 
Philip Hazel  
-- 
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to