-2

I just created a website, and I wanted to create a "search" module, the database was created, and I get connected, the system seems to work except this message which covers my web page:

PHP Error Message:

Warning: preg_match () [function.preg-match]: Compilation failed: unknown property name Effective \ P or \ p at 

offset 7 in / home/a3637125/public_html/Moteur-de-recherche/class.inc/moteur-php5.class-inc.php on line 706 

The relevant code:

if(preg_match('#[\p{Xan}][^a-zA-Z]#iu', $mot)) {
  $mot = str_ireplace($withaccent, $withnoaccent, htmlspecialchars(trim($mot)));
}
dirkk
  • 6,160
  • 5
  • 33
  • 51
hexphp111
  • 419
  • 1
  • 5
  • 13

1 Answers1

2

Your pcre version is too old and doesn't know the unicode character class \p{Xan}. This is not really a problem since you can write:

#[\pL\pN][^a-z]#i

That does exactly the same.

Nota Bene: It will be interesting if you explain what your pattern is supposed to do. If you are trying to replace all accentued characters with an ascii equivalent, I suggest to take a look at this question

Community
  • 1
  • 1
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125
  • Thank you for the reply, I solved the problem fairly quickly, indeed, that's right, just replace the expression like this:' if(preg_match(‘#[a-zàáâãäçèéêëìíîïñòóôõöùúûü][^a-zA-Z]#iu’, $mot)) ' – hexphp111 Jul 10 '14 at 17:45