[pcre-dev] [Bug 1393] the opposite of a reference

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1393] the opposite of a reference
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1393




--- Comment #6 from Philip Hazel <ph10@???> 2013-10-09 11:08:54 ---
On Tue, 8 Oct 2013, ouadji wrote:

> "Even more unlikely is the introduction of a new meta-character like the
> ~ you suggest. It would break many patterns.
>
> ????
> it would not break the existing patterns. (i don't understand)


This existing pattern would break:

(3)~\1

It currently matches the string "3~3".

> The patterns that don't have this character would not be broken
> it would affect only the patterns that inclue this new character.


Indeed, but there are probably many such patterns. I would never
introduce a new non-Perl top-level metacharacter like this.

It did occur to me that, since Perl now uses \g{3} (for example) for
back references, the obvious syntax would be \G{3}, but unfortunately
Perl already uses \G for something else. However, one could use \g{^3} I
suppose, and \g{^-3} and \g{^+3} for relative references, and \g{^name}
for references by name. (^ is used for "not" in other places, so is
better than ~ for this.)

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email