Skip to content

Commit

Permalink
More consistent use of so instead of Bool in regex examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jjatria committed Mar 3, 2016
1 parent b8837d2 commit 7d40fbf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions doc/Language/regexes.pod
Original file line number Diff line number Diff line change
Expand Up @@ -340,34 +340,34 @@ To quantify an atom an arbitrary number of times, you can write e.g.
C<a ** 2..5> to match the character C<a> at least twice and at most 5 times.
=begin code
say Bool('a' ~~ /a ** 2..5/); # False
say Bool('aaa' ~~ /a ** 2..5/); # True
say so 'a' ~~ /a ** 2..5/; # False
say so 'aaa' ~~ /a ** 2..5/; # True
=end code
If the minimal and maximal number of matches are the same, a single integer
is possible: C<a ** 5> matches C<a> exactly five times.
=begin code
say Bool('aaaaa' ~~ /a ** 5/); # True
say so 'aaaaa' ~~ /a ** 5/; # True
=end code
It is also possible to use non inclusive ranges using a caret:
=begin code
say Bool('a' ~~ /a ** 1^..^6); # False
say Bool('aaaa' ~~ /a ** 1^..^6); # True
say so 'a' ~~ /a ** 1^..^6; # False
say so 'aaaa' ~~ /a ** 1^..^6; # True
=end code
This includes the numeric ranges starting from 0:
=begin code
say Bool('aaa' ~~ /a ** ^6/); # True
say so 'aaa' ~~ /a ** ^6/; # True
=end code
or a Whatever operator for an infinite range with a non inclusive minimum:
=begin code
say Bool('aaaa' ~~ /a ~~ 1^..*/); # True
say so 'aaaa' ~~ /a ~~ 1^..*/; # True
=end code
=head2 X<Modified quantifier: %|regex,%;regex,%%>
Expand Down

0 comments on commit 7d40fbf

Please sign in to comment.