Skip to content

Commit 48af140

Browse files
committed
Mention unspace disallowed in regex (except \#)
The current engine disallows unspace in regexex as too ambiguous. This is fine for actual whitespace, but is counterintuitive when people try to backslash the # character. So \# is now specifically allowed to match a literal # character.
1 parent 197d679 commit 48af140

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

S02-bits.pod

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Synopsis 2: Bits and Pieces
88

99
Created: 10 Aug 2004
1010

11-
Last Modified: 2 Sept 2014
12-
Version: 285
11+
Last Modified: 5 Jan 2015
12+
Version: 286
1313

1414
This document summarizes Apocalypse 2, which covers small-scale
1515
lexical items and typological issues. (These Synopses also contain
@@ -293,6 +293,17 @@ it is an end-of-line comment, not an embedded comment. Write:
293293

294294
to mean the other thing.
295295

296+
=head2 Unspace disallowed within regexes
297+
298+
Within a regex, unspace is disallowed as too ambiguous with customary
299+
backslashing conventions in surrounding cultures. Hence you must write
300+
an explicit whitespace match some other way, such as with quotes or with
301+
a C<\x20> or C<\c32> escape. On the other hand, while an unspace can start
302+
with C<\#> in normal code, C<\#> within a regex is specifically allowed,
303+
and is not taken as unspace, but matches a literal U+0023, NUMBER SIGN.
304+
(Within a character class, you may also escape whitespace with a backslash;
305+
the restriction on unspace applies only at the normal pattern-matching level.)
306+
296307
=head2 Optional Whitespace and Exclusions
297308

298309
In general, whitespace is optional in Perl 6 except where it is needed

0 commit comments

Comments
 (0)