You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/Language/glossary.pod6
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -865,7 +865,14 @@ is its usual acronym.
865
865
866
866
=head1property
867
867
868
-
In this context, it either refers to an L<object property|https://docs.perl6.org/language/objects#index-entry-Property>, which is the value of an instance variable, or an L<Unicode property|https://docs.perl6.org/language/regexes#Unicode_Properties> which are codepoint features that allow programs to identify what kind of entity they represent, that is, if they are a letter, or a number, or something completely different like a control character.
@@ -242,14 +242,15 @@ Note that the character classes C«<same>», C«<wb>» and C«<ww>» are
242
242
so called zero-width assertions, which do not really match a
243
243
character.
244
244
245
-
=head2X«Unicode Properties|regex,<:property>»
245
+
=head2X«Unicode properties|regex,<:property>»
246
246
247
247
The character classes mentioned so far are mostly for convenience; another
248
248
approach is to use Unicode character properties. These come in the form
249
249
C«<:property>», where C<property> can be a short or long Unicode General
250
250
Category name. These use pair syntax.
251
251
252
-
To match against a Unicode property you can use either smartmatch or L<C<uniprop>|/routine/uniprop>:
252
+
To match against a Unicode property you can use either smartmatch or
253
+
L<C<uniprop>|/routine/uniprop>:
253
254
254
255
"a".uniprop('Script'); # OUTPUT: «Latin»
255
256
"a" ~~ / <:Script<Latin>> /; # OUTPUT: «「a」»
@@ -325,7 +326,7 @@ parentheses; for example:
325
326
326
327
say $0 if 'perl6' ~~ /\w+(<:Ll+:N>)/ # OUTPUT: «「6」»
327
328
328
-
=head2X«Enumerated Character Classes and Ranges|regex,<[ ]>;regex,<-[ ]>»
329
+
=head2X«Enumerated character classes and ranges|regex,<[ ]>;regex,<-[ ]>»
329
330
330
331
Sometimes the pre-existing wildcards and character classes are not
331
332
enough. Fortunately, defining your own is fairly simple. Within C«<[ ]>»,
@@ -587,7 +588,7 @@ string of non-whitespace characters.
587
588
Even in non-backtracking contexts, the alternation operator C<||> tries
588
589
all the branches in order until the first one matches.
589
590
590
-
=head1X<Longest Alternation: C<|>|regex,|>
591
+
=head1X<Longest alternation: C<|>|regex,|>
591
592
592
593
In short, in regex branches separated by C<|>, the longest token match wins,
593
594
independent of the textual ordering in the regex. However, what C<|> really
@@ -649,7 +650,7 @@ Arrays can also be interpolated into a regex to achieve the same effect:
649
650
my @increasingly-edible = <f fo foo food>;
650
651
say 'food' ~~ /@increasingly-edible/; # OUTPUT: «「food」»
651
652
652
-
This is documented further under L<Regex Interpolation|#Regex_Interpolation>,
653
+
This is documented further under L<Regex Interpolation|#Regex_interpolation>,
653
654
below.
654
655
655
656
=head1X<Conjunction: C<&&>|regex,&&>
@@ -686,7 +687,7 @@ Regexes search an entire string for matches. Sometimes this is not what
686
687
you want. Anchors match only at certain positions in the string, thereby
687
688
anchoring the regex match to that position.
688
689
689
-
=head2X<Start of String and End of String|regex,^;regex,$>
690
+
=head2X<Start of string and end of string|regex,^;regex,$>
690
691
691
692
The C<^> anchor only matches at the start of the string:
692
693
@@ -729,7 +730,7 @@ The following is a multi-line string:
729
730
# 'and' is at the start of a line -- not the string
730
731
say so $str ~~ /^and /; # OUTPUT: «False»
731
732
732
-
=head2X<Start of Line and End of Line|regex,^^;regex,$$>
733
+
=head2X<Start of line and end of line|regex,^^;regex,$$>
733
734
734
735
The C<^^> anchor matches at the start of a logical line. That is, either
735
736
at the start of the string, or after a newline character. However, it does not
@@ -774,7 +775,7 @@ two leading spaces each.
774
775
# matched at the last line
775
776
say so $str ~~ / '."' $$/; # OUTPUT: «True»
776
777
777
-
=head2X«Word Boundary|regex, <|w>;regex, <!|w>»
778
+
=head2X«Word boundary|regex, <|w>;regex, <!|w>»
778
779
779
780
To match any word boundary, use C«<|w>» or C«<?wb>». This is similar to
780
781
X«C<\b>|regex deprecated,\b» of other languages.
@@ -860,7 +861,7 @@ lookahead and lookbehind assertions.
860
861
Technically, anchors are also zero-width assertions, and they can look
861
862
both ahead and behind.
862
863
863
-
=head2X<Lookahead Assertions|regex,before>
864
+
=head2X<Lookahead assertions|regex,before>
864
865
865
866
To check that a pattern appears before another pattern, use a
866
867
lookahead assertion via the C<before> assertion. This has the form:
@@ -942,7 +943,9 @@ These are, as in the case of lookahead, zero-width assertions which do not I<con
942
943
say "atfoobar" ~~ / (.**3) .**2 <?after foo> bar /;
943
944
# OUTPUT: «「atfoobar」 0 => 「atf」»
944
945
945
-
where we capture the first 3 of the 5 characters before bar, but only if C<bar> is preceded by C<foo>. The fact that the assertion is zero-width allows us to use part of the characters in the assertion for capture.
946
+
where we capture the first 3 of the 5 characters before bar, but only if C<bar>
947
+
is preceded by C<foo>. The fact that the assertion is zero-width allows us to
948
+
use part of the characters in the assertion for capture.
946
949
947
950
948
951
@@ -1065,7 +1068,9 @@ it in a variable first:
1065
1068
1066
1069
1067
1070
X<|:my>
1068
-
C<:my> helps scoping the C<$c> variable within the regex and beyond; in this case we can use it in the next sentence to show what has been matched inside the regex. This can be used for debugging inside regular expressions, for instance:
1071
+
C<:my> helps scoping the C<$c> variable within the regex and beyond; in this
1072
+
case we can use it in the next sentence to show what has been matched inside the
1073
+
regex. This can be used for debugging inside regular expressions, for instance:
0 commit comments