4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 $operators = array('not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'matches', '**');
13 $operators = array_combine($operators, array_map('strlen', $operators));
17 foreach ($operators as $operator => $length) {
18 // an operator that ends with a character must be followed by
19 // a whitespace or a parenthesis
20 $regex[] = preg_quote($operator, '/').(ctype_alpha($operator[$length - 1]) ? '(?=[\s(])' : '');
23 echo '/'.implode('|', $regex).'/A';