Weird error using preg_match and unicode

Posted by Thorpe Obazee on Stack Overflow See other posts from Stack Overflow or by Thorpe Obazee
Published on 2010-03-09T04:02:17Z Indexed on 2010/03/09 4:06 UTC
Read the original article Hit count: 240

Filed under:
|
|
if (preg_match('(\p{Nd}{4}/\p{Nd}{2}/\p{Nd}{2}/\p{L}+)', '2010/02/14/this-is-something'))
{
  // do stuff
}

The above code works. However this one doesn't.

if (preg_match('/\p{Nd}{4}/\p{Nd}{2}/\p{Nd}{2}/\p{L}+/u', '2010/02/14/this-is-something'))
{
    // do stuff
}

Maybe someone could shed some light as to why the one below doesn't work. This is the error that is being produced:

A PHP Error was encountered

Severity: Warning

Message: preg_match() [function.preg-match]: Unknown modifier '\'

© Stack Overflow or respective owner

Related posts about regex

Related posts about unicode