Compilation failed: unknown property name after \P or \p

pdo, php, preg-match, regex, sqlite

Solution

You need 3 backslahes `\\\`. Check this example:

$string = "\par hello \par world";
$pattern = '/\\\par/';
preg_match_all($pattern, $string, $matches);

var_dump($matches);

You can find more info in the PHP manual

You have updated the question, I see you aren't using `preg_match` you are using the SQL `REGEXP` function. However, the SQL function should work with `\\\` as well.

Problem

Hi I want to match a string: `"\par hello \par world"` Against my regexp pattern -> `\\par` However, I get a `Compilation failed: unknown property name after \P or \p` I believe my regexp rule is treated as a unicode character property. How do I escape it and run the pattern as it is? I am including it in a PDO function like so. ``` function sqlite_regExp($sql,$db) { if($db->sqliteCreateFunction("regexp", "preg_match", 2) === FALSE) exit("Failed creating function!"); if($res = $db->query($sql)->fetchAll()){ return $res; } else return false; } ``` I am calling the function like so ``` sqlite_regExp("SELECT COUNT(*) FROM table WHERE REGEXP('/\\par/',column) ",$db) ```

Original source