1.2.1035. Regex Delimiter¶
PCRE regular expressions may use a variety of delimiters.
There seems to be a standard delimiter in the code, and some exceptions : one or several forms are dominant (> 90%), while the others are rare.
The analyzed code has less than 10% of the rare delimiters. For consistency reasons, it is recommended to make them all the same.
Generally, one or two delimiters are used, depending on the expected special chars in the scanned strings : for example, / tends to be avoided when parsing HTML.
Regex are literals, or partial literals, used in preg_match(), preg_match_all(), preg_replace(), preg_replace_callback(), preg_replace_callback_array().
<?php
echo 'a';
echo 'b';
echo 'c';
echo 'd';
echo 'e';
echo 'f';
echo 'g';
echo 'h';
echo 'i';
echo 'j';
echo 'k';
// This should probably be written 'echo';
print 'l';
?>
See also Ideal regex delimiters in PHP.
1.2.1035.1. Connex PHP features¶
1.2.1035.1.1. Specs¶
Short name |
Structures/RegexDelimiter |
Rulesets |
|
Exakat since |
0.10.5 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |