View Full Version : Regular Expression Fix

12-02-2003, 11:58 PM
Hi. A regex used in PhpDig versions 1.6.3 and 1.6.4 does not permit certain characters like ß in a search. To fix this do the following.

In search_function.php find:

if (eregi("[^[:alnum:]^ +^-]+",$query_to_parse)) { $query_to_parse = eregi_replace("[^[:alnum:]^ ]+"," ",$query_to_parse); }

and replace with the following:

$what_query_chars = "[^".$phpdig_words_chars[PHPDIG_ENCODING]." -]+";
if (eregi($what_query_chars,$query_to_parse)) {
$query_to_parse = eregi_replace($what_query_chars," ",$query_to_parse);

Also in search_function.php find:

// init variables

and right after add the following:

global $phpdig_words_chars;