This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
perldelta: Note Perl version of regexp_pattern()
[perl5.git]
/
pod
/
perldelta.pod
diff --git
a/pod/perldelta.pod
b/pod/perldelta.pod
index
288691e
..
b2d2313
100644
(file)
--- a/
pod/perldelta.pod
+++ b/
pod/perldelta.pod
@@
-72,7
+72,7
@@
not have to change (after this one time), as the stringification will
automatically incorporate the new modifiers.
Code that needs to work properly with both old- and new-style regexes
automatically incorporate the new modifiers.
Code that needs to work properly with both old- and new-style regexes
-can avoid the whole issue by using:
+can avoid the whole issue by using
(for Perls since 5.9.5)
:
use re qw(regexp_pattern);
my ($pat, $mods) = regexp_pattern($re_ref);
use re qw(regexp_pattern);
my ($pat, $mods) = regexp_pattern($re_ref);
@@
-82,8
+82,8
@@
return, C<$mods> will be a string containing all the non-default
modifiers used when the regular expression was compiled, and C<$pattern>
the actual pattern.
modifiers used when the regular expression was compiled, and C<$pattern>
the actual pattern.
-If the actual stringification is important,
you can use something lik
e
-the following:
+If the actual stringification is important,
or older Perls need to b
e
+
supported, you can use something like
the following:
# Accept both old and new-style stringification
my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism';
# Accept both old and new-style stringification
my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism';