Index: branches/REL1_17/phase3/includes/IP.php |
— | — | @@ -39,17 +39,18 @@ |
40 | 40 | ':(?::|(?::' . RE_IPV6_WORD . '){1,7})' . |
41 | 41 | '|' . // ends with "::" (except "::") |
42 | 42 | RE_IPV6_WORD . '(?::' . RE_IPV6_WORD . '){0,6}::' . |
43 | | - '|' . // contains no "::" |
44 | | - RE_IPV6_WORD . '(?::' . RE_IPV6_WORD . '){7}' . |
45 | | - '|' . // contains one "::" in the middle and 2 words |
46 | | - RE_IPV6_WORD . '::' . RE_IPV6_WORD . |
47 | | - '|' . // contains one "::" in the middle and 3+ words (awkward regex for PCRE 4.0+) |
| 43 | + '|' . // contains one "::" in the middle, ending in "::WORD" |
| 44 | + RE_IPV6_WORD . '(?::' . RE_IPV6_WORD . '){0,5}' . '::' . RE_IPV6_WORD . |
| 45 | + '|' . // contains one "::" in the middle, not ending in "::WORD" (regex for PCRE 4.0+) |
48 | 46 | RE_IPV6_WORD . '(?::(?P<abn>:(?P<iabn>))?' . RE_IPV6_WORD . '(?!:(?P=abn))){1,5}' . |
49 | 47 | ':' . RE_IPV6_WORD . '(?P=iabn)' . |
50 | 48 | // NOTE: (?!(?P=abn)) fails iff "::" used twice; (?P=iabn) passes iff a "::" was found. |
51 | | - // RegExp (PCRE 7.2+ only) for last 2 cases that allows easy regex concatenation: |
52 | | - #RE_IPV6_WORD . '(?::((?(-1)|:))?' . RE_IPV6_WORD . '){1,6}(?(-2)|^)' . |
| 49 | + '|' . // contains no "::" |
| 50 | + RE_IPV6_WORD . '(?::' . RE_IPV6_WORD . '){7}' . |
53 | 51 | ')' |
| 52 | + // NOTE: With PCRE 7.2+, we can combine the two '"::" in the middle' cases into: |
| 53 | + // RE_IPV6_WORD . '(?::((?(-1)|:))?' . RE_IPV6_WORD . '){1,6}(?(-2)|^)' |
| 54 | + // This also improves regex concatenation by using relative references. |
54 | 55 | ); |
55 | 56 | // An IPv6 block is an IP address and a prefix (d1 to d128) |
56 | 57 | define( 'RE_IPV6_BLOCK', RE_IPV6_ADD . '\/' . RE_IPV6_PREFIX ); |
Property changes on: branches/REL1_17/phase3/includes/IP.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
57 | 58 | Merged /branches/new-installer/phase3/includes/IP.php:r43664-66004 |
58 | 59 | Merged /branches/wmf-deployment/includes/IP.php:r53381 |
59 | 60 | Merged /branches/REL1_15/phase3/includes/IP.php:r51646 |
60 | 61 | Merged /branches/sqlite/includes/IP.php:r58211-58321 |
61 | 62 | Merged /trunk/phase3/includes/IP.php:r82093,82095,82474,82845,82847-82848 |