File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1610,8 +1610,21 @@ backslash C<\> or included in quotes:
1610
1610
s/Space\:/Party like it's/;
1611
1611
.say # OUTPUT: «Party like it's 1999»
1612
1612
1613
- Note that the matching restrictions only apply to the left-hand side of the
1614
- substitution expression.
1613
+ Note that the matching restrictions generally only apply to the left-hand side of the
1614
+ substitution expression, but some special characters or combinations of them may need
1615
+ to be escaped. For example
1616
+
1617
+ $_ = 'foo';
1618
+ s/foo/\%(/;
1619
+ .say # OUTPUT: <<%(\n>>
1620
+
1621
+ or escape the '(' instead for the same result
1622
+
1623
+ s/foo/%\(/;
1624
+ .say # OUTPUT: <<%(\n>>
1625
+
1626
+ but using either character alone does not require escaping. Forward slashes will need
1627
+ to be escaped, but escaping alphanumeric characters will cause them to be ignored.
1615
1628
1616
1629
By default, substitutions are only done on the first match:
1617
1630
You can’t perform that action at this time.
0 commit comments