From 7eebb4859fd09d08288acb2cc57d1aebdede162f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 8 Nov 2011 15:18:38 +0000 Subject: handle named character classes --- it.class | 4 ++-- tests/it.t | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/it.class b/it.class index 371d9e4..69626bb 100644 --- a/it.class +++ b/it.class @@ -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; diff --git a/tests/it.t b/tests/it.t index 22fd194..c356ad0 100755 --- a/tests/it.t +++ b/tests/it.t @@ -74,6 +74,11 @@ match( 'Üblahä', 'include umlaute in \w' ); +match( + '[[:alpha:]]+', ' |#blahä ', + 'blahä', + 'include umlaute in \w' + ); match( '\W+', ' |#Üblahä ', ' |#', -- cgit v1.2.3