use Data::Dumper; use strict; use warnings; use constant SUCCEED => qr{(?=)}; use constant FAIL => qr{(?!)}; my $QUOTED = qr/".+?"/; my $NUM = qr/\d*\.\d*/; my $VALUE = do { use re 'eval'; qr/(?:$QUOTED|$NUM)(??{'.' eq $& ? FAIL : SUCCEED})/; }; my $text = 'name => "foo", fav.num => 3.123'; my @text = split /($VALUE)/ => $text; print Dumper \@text; __END__ C:\temp>perl re.pl $VAR1 = [ 'name => ', '"foo"', ', fav.num => ', '3.123' ];
In reply to Re: Forcing a regex to fail
by davidrw
in thread Forcing a regex to fail
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |