I\'ve just installed a website & legacy CMS onto our server and I\'m getting a POSIX compilation error. Luckily it\'s only appearing in the backend however the client\'s
[...]
are character classes, they match any character between the brackets, you don't have to add |
between them. See character classes.
So [abcd]
will match a or b or c or d
.
If you want to match alternations of more than one character, for example red or blue or yellow
, use a sub pattern:
"(red|blue|yellow)"
And you guessed, [abcd]
is equivalent to (a|b|c|d)
.
So here is what you could do for your regex:
For
$trenner = "[\040|\n|\t|\r]*";
Write this instead:
$trenner = "[\040\n\t\r]*";
And for
"[=\"|=\'|=\\\\|=]"
You could do
"(=\"|=\'|=\\\\|=)"
Or
"=[\"'\\\\]?"
BTW you could use \s
instead of $trenner
(see http://www.php.net/manual/en/regexp.reference.escape.php)