diff options
author | Karl Williamson <khw@cpan.org> | 2017-01-10 10:31:29 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-01-13 12:20:04 -0700 |
commit | cbe2fc5001aa59cdc73e04cc35e097a2ecfbeec0 (patch) | |
tree | 0a63674346d1157df200911aee3ebce0930a3155 /ext/re | |
parent | a4368cc338f9178e7f4861a61ab56710050e50dc (diff) | |
download | perl-cbe2fc5001aa59cdc73e04cc35e097a2ecfbeec0.tar.gz |
re.pm: pod formatting nits, and clarifications
Diffstat (limited to 'ext/re')
-rw-r--r-- | ext/re/re.pm | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/ext/re/re.pm b/ext/re/re.pm index 123408c76f..c416b94c28 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -332,7 +332,7 @@ re - Perl pragma to alter regular expression behaviour use re qw(is_regexp regexp_pattern); # import utility functions my ($pat,$mods)=regexp_pattern(qr/foo/i); - if (is_regexp($obj)) { + if (is_regexp($obj)) { print "Got regexp: ", scalar regexp_pattern($obj); # just as perl would stringify } # it but no hassle with blessed @@ -421,20 +421,34 @@ under non-strict. =head2 '/flags' mode -When C<use re '/flags'> is specified, the given flags are automatically +When C<use re '/I<flags>'> is specified, the given I<flags> are automatically added to every regular expression till the end of the lexical scope. - -C<no re '/flags'> will turn off the effect of C<use re '/flags'> for the +I<flags> can be any combination of +C<'a'>, +C<'aa'>, +C<'d'>, +C<'i'>, +C<'l'>, +C<'m'>, +C<'n'>, +C<'p'>, +C<'s'>, +C<'u'>, +C<'x'>, +and/or +C<'xx'>. + +C<no re '/I<flags>'> will turn off the effect of C<use re '/I<flags>'> for the given flags. -For example, if you want all your regular expressions to have /msx on by +For example, if you want all your regular expressions to have /msxx on by default, simply put - use re '/msx'; + use re '/msxx'; at the top of your code. -The character set /adul flags cancel each other out. So, in this example, +The character set C</adul> flags cancel each other out. So, in this example, use re "/u"; "ss" =~ /\xdf/; @@ -443,6 +457,13 @@ The character set /adul flags cancel each other out. So, in this example, the second C<use re> does an implicit C<no re '/u'>. +Similarly, + + use re "/xx"; # Doubled-x + ... + use re "/x"; # Single x from here on + ... + Turning on one of the character set flags with C<use re> takes precedence over the C<locale> pragma and the 'unicode_strings' C<feature>, for regular expressions. Turning off one of these flags when it is active reverts to @@ -468,7 +489,7 @@ strings on/off, pre-point part on/off. See L<perldebug/"Debugging Regular Expressions"> for additional info. As of 5.9.5 the directive C<use re 'debug'> and its equivalents are -lexically scoped, as the other directives are. However they have both +lexically scoped, as the other directives are. However they have both compile-time and run-time effects. See L<perlmodlib/Pragmatic Modules>. |