Skip to content

Commit b00b047

Browse files
authored
Update regexes.pod6
1. Remove `=head1 Look-around assertions` and put `Lookahead/Lookbehind assertions` into `Anchor` 2. Add example to show difference between C«<|w>» and C<«>, C<»>:
1 parent 79adcde commit b00b047

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

doc/Language/regexes.pod6

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,14 @@ You can also use the variants C<«> and C<»> :
741741
say so $str ~~ /« own/; # OUTPUT: «False␤»
742742
say so $str ~~ /own »/; # OUTPUT: «True␤»
743743
744-
=head1 Look-around assertions
744+
To see the difference between C«<|w>» and C<«>, C<»>:
745745
746-
=head2 X<Lookahead assertions|regex,before>
746+
say "stuff here!!!".subst(:g, />>/, '|'); # OUTPUT: «stuff| here|!!!␤»
747+
say "stuff here!!!".subst(:g, /<</, '|'); # OUTPUT: «|stuff |here!!!␤»
748+
say "stuff here!!!".subst(:g, /<|w>/, '|'); # OUTPUT: «|stuff| |here|!!!␤»
749+
750+
751+
=head2 X<Lookahead assertions C«<?before pattern>»|regex,before>
747752
748753
To check that a pattern appears before another pattern, use a
749754
lookahead assertion via the C<before> assertion. This has the form:
@@ -770,7 +775,7 @@ match with
770775
771776
say "foobar" ~~ rx{ foo <!before bar> } # OUTPUT: «Nil␤»
772777
773-
=head2 X<Lookbehind assertions|regex,after>
778+
=head2 X<Lookbehind assertions C«<?after pattern>»|regex,after>
774779
775780
To check that a pattern appears before another pattern, use a
776781
lookbehind assertion via the C<after> assertion. This has the form:

0 commit comments

Comments
 (0)