in reply to Re: Roughly matching an ipv6 address with sql wildcard
in thread Roughly matching an ipv6 address with sql wildcard

You are right on all counts. I do not know why the extra brackets are needed. I must sleep on it.

Neil Watson
watson-wilson.ca

  • Comment on Re^2: Roughly matching an ipv6 address with sql wildcard

Replies are listed 'Best First'.
Re^3: Roughly matching an ipv6 address with sql wildcard
by graff (Chancellor) on Sep 10, 2015 at 02:03 UTC
    The extra parens are needed in order for the anchors to do what you want. The OP regex was really saying: "if the string STARTS with an IPv6 string, OR if it ENDS with something that contains one or more IP address characters and/or percent signs".

    BTW, you might want to include underscore as a possible sql wildcard character, because it is (and can be very useful in certain cases).

      Does that mean that \A and \Z bind more tightly than | and if so, where is this precedence listed?

      Neil Watson
      watson-wilson.ca

        Everything is explained in the perlre man page. The first subsection under "Regular Expressions" is "Metacharacters", where it should be clear that there is no difference in "precedence" between anchors and the alternation operator (\A and \Z are just variations on ^ and $). In fact, it's not so much a matter of "binding" or "precedence", but rather an issue of "grouping" (via parens, which are also explained in that same section).
Re^3: Roughly matching an ipv6 address with sql wildcard
by Anonymous Monk on Sep 10, 2015 at 02:12 UTC