When trying to do a search in a mbstring, I sometimes(!) get the following error:
 
"
Warning: mb_ereg_search()[function.mb-ereg-search]:mbregex compile err: premature end 
of regular expression in c:\myfile.php on line 12.
"
 
It's only the case for some strings. Why is this? I assume it must something related 
to the word itself interacting with the mbfunctions
I'm using PHP 4.3.0.
 
 
Thanks a lot!!!!!
Simon
 
 
 
Maybe this little file helps to see what i'm talking about: Copy & paste away
 
<html>
<head>
<meta http-equiv="Content-Type" content="Text/Html; Charset=UTF-8">
<title>coding-problem</title>
</head>
<body>
<?php
$examplesnt="わたしわ";
$word="愛犬";
//**************************FUNCTIONS*******************************************
function find_word($word,$sentence)
{ mb_ereg_search_init ($sentence);
$result=mb_ereg_search($word);
if($result==1){
echo "$sentence contains $word<br>";
} 
return $result;
}
 
//************************MAIN**************************************************
/* Set internal character encoding to UTF-8 */
mb_internal_encoding("UTF-8");
/* Display current internal character encoding */
echo mb_internal_encoding()."<br>"; 
echo $examplesnt." is the example sentence<br>";
echo $word." is the word we're looking for in the sentence<br>";// i know the word is 
not in it, but that doesn't matter
find_word($word,$examplesnt);
?>
</body>
</html>
 
 
 


Reply via email to