1

What is the meaning of of the warning?

Warning: preg_replace() [function.preg-replace]: Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1 in

It's being triggered by this function:

file_put_contents($file,preg_replace('(\uid=\d+)', 'uid=' . $uid, file_get_contents($file)));

Namely this pattern:

'(\uid=\d+)'

It works locally, but not online, meaning it's probably my host's version of PHP. I've tried to google a work-around, but can't find anything.

Matt
  • 5,315
  • 1
  • 30
  • 57
Starkers
  • 10,273
  • 21
  • 95
  • 158

3 Answers3

5

PCRE doesn't support the \u espace sequence.

In other words, your regex is not correct. Try something like (uid=\d+) instead.

As said in comments (thanks Mellamokb), here is the source.

If you want to know what is the \u, you can look here

\u Titlecase next character. Not in [ ].

Jaffa
  • 12,442
  • 4
  • 49
  • 101
0
file_put_contents($file,preg_replace('/uid=\d+/', 'uid=' . $uid, file_get_contents($file)));
rationalboss
  • 5,330
  • 3
  • 30
  • 50
0

RegExp pattern should be bounded by / delimiters, you can also use (# or ~). Moreover there is no escape sequence \u. You may wanna try this -

preg_replace('/\\uid=\d+/', 'uid=' . $uid, file_get_contents($file))
ShuklaSannidhya
  • 8,572
  • 9
  • 32
  • 45