@@ -20,6 +20,18 @@ The component supports:
2020* **booleans ** - ``true `` and ``false ``
2121* **null ** - ``null ``
2222
23+ .. caution ::
24+
25+ A backslash (``\ ``) must be escaped by 4 backslashes (``\\\\ ``) in a string
26+ and 8 backslashes (``\\\\\\\\ ``) in a regex::
27+
28+ echo $language->evaluate('"\\\\"'); // prints \
29+ $language->evaluate('"a\\\\b" matches "/^a\\\\\\\\b$/"'); // returns true
30+
31+ Control characters (e.g. ``\n ``) in expressions are replaced with
32+ whitespace. To avoid this, escape the sequence with a single backslash
33+ (e.g. ``\\n ``).
34+
2335.. _component-expression-objects :
2436
2537Working with Objects
@@ -181,28 +193,6 @@ Comparison Operators
181193 You must use parenthesis because the unary operator ``not `` has precedence
182194 over the binary operator ``matches ``.
183195
184- A backslash(``\ ``) must be escaped by 4 backslashes(``\\\\ ``) in a string and
185- 8 backslashes(``\\\\\\\\ ``) in a regex::
186-
187- $language->evaluate('"\\\\"');
188- // returns \
189-
190- $language->evaluate('"a\\\\b" matches "/^a\\\\\\\\b$/"');
191- // returns true
192-
193- Control characters must be defined as the escaped form of their escape sequences.
194- Otherwise, they will be replaced by spaces and ignored::
195-
196- $language->evaluate('"a\nb"');
197- // returns a b
198-
199- $language->evaluate('"a\\nb"');
200- // returns a\nb
201-
202- This is because the backslashes in a string will be stripped by the
203- ``stripcslashes() `` function and the stripped slashes in a regex will be
204- stripped again by the regex engine.
205-
206196Examples::
207197
208198 $ret1 = $language->evaluate(
0 commit comments