diff options
author | Urban Müller | 2011-11-08 15:18:38 +0000 |
---|---|---|
committer | Urban Müller | 2011-11-08 15:18:38 +0000 |
commit | 7eebb4859fd09d08288acb2cc57d1aebdede162f (patch) | |
tree | f3e869545d7385b55303b9794729b2de3248fe1f | |
parent | baff0f7a13d4338dde7e08405e421666e1135929 (diff) | |
download | itools-7eebb4859fd09d08288acb2cc57d1aebdede162f.tar.gz itools-7eebb4859fd09d08288acb2cc57d1aebdede162f.tar.bz2 itools-7eebb4859fd09d08288acb2cc57d1aebdede162f.zip |
handle named character classes
-rw-r--r-- | it.class | 4 | ||||
-rwxr-xr-x | tests/it.t | 5 |
2 files changed, 7 insertions, 2 deletions
@@ -350,7 +350,7 @@ static function convertregex($pattern, $p = array()) */ static function match($pattern, $string, $p = null) { - if (!preg_match('/\\\\[wb]|[!\x80-\xff]/i', $pattern) && !$p) + if (!preg_match('/\\\\[wb]|[!\x80-\xff]|\[\[:/i', $pattern) && !$p) $r = preg_match('!' . $pattern . '!i', $string, $m); # fast path for simple patterns else { @@ -369,7 +369,7 @@ static function match($pattern, $string, $p = null) if (!$r) # no match { - if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) # Silence phpversionlint.php commit hook: function_exists('preg_last_error') + if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) it::error("Exceeded pcre.backtrack_limit of " . ini_get('pcre.backtrack_limit') . " bytes"); $result = $p['all'] ? array() : null; @@ -75,6 +75,11 @@ match( 'include umlaute in \w' ); match( + '[[:alpha:]]+', ' |#blahä ', + 'blahä', + 'include umlaute in \w' + ); +match( '\W+', ' |#Üblahä ', ' |#', 'don\'t include umlaute in \W' |