# allow checking for valid ': attrlist' attachments
my $nested;
-$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x;
+$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x;
my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
$input_expr{$key} =~ s/\n+$//;
}
-$bal = qr[(?:(?>[^()]+)|\((?p{ $bal })\))*]; # ()-balanced
+$bal = qr[(?:(?>[^()]+)|\((??{ $bal })\))*]; # ()-balanced
$cast = qr[(?:\(\s*SV\s*\*\s*\)\s*)?]; # Optional (SV*) cast
-$size = qr[,\s* (?p{ $bal }) ]x; # Third arg (to setpvn)
+$size = qr[,\s* (??{ $bal }) ]x; # Third arg (to setpvn)
foreach $key (keys %output_expr) {
use re 'eval';
($output_expr{$key} =~
m[^ \s+ sv_set ( [iunp] ) v (n)? # Type, is_setpvn
\s* \( \s* $cast \$arg \s* ,
- \s* ( (?p{ $bal }) ) # Set from
- ( (?p{ $size }) )? # Possible sizeof set-from
+ \s* ( (??{ $bal }) ) # Set from
+ ( (??{ $size }) )? # Possible sizeof set-from
\) \s* ; \s* $
]x);
$targetable{$key} = [$t, $with_size, $arg, $sarg] if $t;
my ($C_group_rex, $C_arg);
# Group in C (no support for comments or literals)
$C_group_rex = qr/ [({\[]
- (?: (?> [^()\[\]{}]+ ) | (?p{ $C_group_rex }) )*
+ (?: (?> [^()\[\]{}]+ ) | (??{ $C_group_rex }) )*
[)}\]] /x ;
# Chunk in C without comma at toplevel (no comments):
$C_arg = qr/ (?: (?> [^()\[\]{},"']+ )
- | (?p{ $C_group_rex })
+ | (??{ $C_group_rex })
| " (?: (?> [^\\"]+ )
| \\.
)* " # String literal
my %out_vars;
if ($process_argtypes and $orig_args =~ /\S/) {
my $args = "$orig_args ,";
- if ($args =~ /^( (?p{ $C_arg }) , )* $ /x) {
- @args = ($args =~ /\G ( (?p{ $C_arg }) ) , /xg);
+ if ($args =~ /^( (??{ $C_arg }) , )* $ /x) {
+ @args = ($args =~ /\G ( (??{ $C_arg }) ) , /xg);
for ( @args ) {
s/^\s+//;
s/\s+$//;
# allow checking for valid ': attrlist' attachments
my $nested;
-$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x;
+$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x;
my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
Better yet, use the carefully constrained evaluation within a Safe
module. See L<perlsec> for details about both these mechanisms.
-=item C<(?p{ code })>
+=item C<(??{ code })>
B<WARNING>: This extended regular expression feature is considered
highly experimental, and may be changed or deleted without notice.
(?:
(?> [^()]+ ) # Non-parens without backtracking
|
- (?p{ $re }) # Group with matching parens
+ (??{ $re }) # Group with matching parens
)*
\)
}x;
For this grouping operator there is no need to describe the ordering, since
only whether or not C<S> can match is important.
-=item C<(?p{ EXPR })>
+=item C<(??{ EXPR })>
The ordering is the same as for the regular expression which is
the result of EXPR.
C<(?#text)>, C<(?imsx-imsx)>, C<(?:pattern)>, C<(?imsx-imsx:pattern)>,
C<(?=pattern)>, C<(?!pattern)>, C<(?E<lt>=pattern)>, C<(?<!pattern)>, C<(?{
-code })>, C<(?p{ code })>, C<(?E<gt>pattern)>,
+code })>, C<(??{ code })>, C<(?E<gt>pattern)>,
C<(?(condition)yes-pattern|no-pattern)>, C<(?(condition)yes-pattern)>
=item Backtracking
C<ST>, C<S|T>, C<S{REPEAT_COUNT}>, C<S{min,max}>, C<S{min,max}?>, C<S?>,
C<S*>, C<S+>, C<S??>, C<S*?>, C<S+?>, C<(?E<gt>S)>, C<(?=S)>, C<(?<=S)>,
-C<(?!S)>, C<(?<!S)>, C<(?p{ EXPR })>,
+C<(?!S)>, C<(?<!S)>, C<(??{ EXPR })>,
C<(?(condition)yes-pattern|no-pattern)>
=item Creating custom RE engines
nextchar();
*flagp = TRYAGAIN;
return NULL;
- case 'p':
+ case '?':
logical = 1;
paren = *PL_regcomp_parse++;
/* FALL THROUGH */
########
re();
sub re {
- my $re = join '', eval 'qr/(?p{ $obj->method })/';
+ my $re = join '', eval 'qr/(??{ $obj->method })/';
$re;
}
EXPECT
$test++;
my $matched;
-$matched = qr/\((?:(?>[^()]+)|(?p{$matched}))*\)/;
+$matched = qr/\((?:(?>[^()]+)|(??{$matched}))*\)/;
@ans = @ans1 = ();
push(@ans, $res), push(@ans1, $&) while $res = m/$matched/g;
$test++;
$brackets = qr{
- { (?> [^{}]+ | (?p{ $brackets }) )* }
+ { (?> [^{}]+ | (??{ $brackets }) )* }
}x;
"{{}" =~ $brackets;
print "ok $test\n"; # Did we survive?
$test++;
-"something { long { and } hairy" =~ m/((?p{ $brackets }))/;
+"something { long { and } hairy" =~ m/((??{ $brackets }))/;
print "not " unless $1 eq "{ and }";
print "ok $test\n";
$test++;
while (s < send && *s != ')')
*d++ = *s++;
} else if (s[2] == '{'
- || s[2] == 'p' && s[3] == '{') { /* This should march regcomp.c */
+ || s[2] == '?' && s[3] == '{') { /* This should march regcomp.c */
I32 count = 1;
char *regparse = s + (s[2] == '{' ? 3 : 4);
char c;