@@ -111,10 +111,10 @@ public static function normalize(string $s): string
111111 $ s = self ::normalizeNewLines ($ s );
112112
113113 // remove control characters; leave \t + \n
114- $ s = preg_replace ( ' #[\x00-\x08\x0B-\x1F\x7F-\x9F]+#u ' , '' , $ s );
114+ $ s = self :: pcre ( ' preg_replace ' , [ ' #[\x00-\x08\x0B-\x1F\x7F-\x9F]+#u ' , '' , $ s] );
115115
116116 // right trim
117- $ s = preg_replace ( ' #[\t ]+$#m ' , '' , $ s );
117+ $ s = self :: pcre ( ' preg_replace ' , [ ' #[\t ]+$#m ' , '' , $ s] );
118118
119119 // leading and trailing blank lines
120120 $ s = trim ($ s , "\n" );
@@ -163,7 +163,7 @@ public static function toAscii(string $s): string
163163 . "\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
164164 . "\x96\xa0\x8b\x97\x9b\xa6\xad\xb7" ,
165165 'ALLSSSSTZZZallssstzzzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTsraaaalccceeeeiiddnnooooruuuuyt- <->|-. ' );
166- $ s = preg_replace ( ' #[^\x00-\x7F]++# ' , '' , $ s );
166+ $ s = self :: pcre ( ' preg_replace ' , [ ' #[^\x00-\x7F]++# ' , '' , $ s] );
167167 } else {
168168 $ s = iconv ('UTF-8 ' , 'ASCII//TRANSLIT//IGNORE ' , $ s );
169169 }
@@ -181,7 +181,7 @@ public static function webalize(string $s, string $charlist = null, bool $lower
181181 if ($ lower ) {
182182 $ s = strtolower ($ s );
183183 }
184- $ s = preg_replace ( ' #[^a-z0-9 ' . ($ charlist !== null ? preg_quote ($ charlist , '# ' ) : '' ) . ']+#i ' , '- ' , $ s );
184+ $ s = self :: pcre ( ' preg_replace ' , [ ' #[^a-z0-9 ' . ($ charlist !== null ? preg_quote ($ charlist , '# ' ) : '' ) . ']+#i ' , '- ' , $ s] );
185185 $ s = trim ($ s , '- ' );
186186 return $ s ;
187187 }
0 commit comments