Skip to content

Commit 8e56130

Browse files
committed
minor symfony#19074 [Expression Language] Number of backslashes to escape a backslash (devojifr)
This PR was merged into the 5.4 branch. Discussion ---------- [Expression Language] Number of backslashes to escape a backslash To escape a backslash in a string, we must use 3 backslashes before the backslash itself. The documentation points out we need to escape by 4 backslashes the backslash. It could be confusing, the total would 5 backslashes. Commits ------- a67b566 [Expression Language] Clarify number of backslashes to escape a backslash
2 parents 284a304 + a67b566 commit 8e56130

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reference/formats/expression_language.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ The component supports:
2020

2121
.. caution::
2222

23-
A backslash (``\``) must be escaped by 4 backslashes (``\\\\``) in a string
24-
and 8 backslashes (``\\\\\\\\``) in a regex::
23+
A backslash (``\``) must be escaped by 3 backslashes (``\\\\``) in a string
24+
and 7 backslashes (``\\\\\\\\``) in a regex::
2525

2626
echo $expressionLanguage->evaluate('"\\\\"'); // prints \
2727
$expressionLanguage->evaluate('"a\\\\b" matches "/^a\\\\\\\\b$/"'); // returns true

0 commit comments

Comments
 (0)