T
Tassilo v. Parseval
Also sprach Abigail:
I guess this the case. Yet, I wonder why perl lets me do it. It could
easily barf when it encounters anything that requires re-entrantness
in (?{}) and (??{}).
Next to /, it's my default-delimiter. As I virtually never use /x, I
seldom question its use.
Tassilo
Tassilo v. Parseval ([email protected]) wrote on
MMMMCCXLV September MCMXCIII in <URL)
() Indeed, this is much better. Interestingly enough, it stops working when
() using split:
()
() use strict;
() use warnings;
() no warnings qw /syntax/;
()
() my $word = "gremlin";
() my $ana = "nlmregi";
()
() my (%h);
() print $word =~ m#
() ^(?{%h = ()})
() (?{$h {$_} ++ for split //, $ana})
() (?: (.) (?(?{$h {$1} --> 0})|(?!)) )*
() $(?(?{grep {$_} values %h})(?!)|)#x
() ? "match\n" : "no match\n";
()
() As far as I see it, this code should be functionally equivalent to
() yours. Probably these extended patterns don't work too well when another
() pattern match happens inside.
The regex engine is not re-entrant. So you can't use split inside
a regex.
I guess this the case. Yet, I wonder why perl lets me do it. It could
easily barf when it encounters anything that requires re-entrantness
in (?{}) and (??{}).
(And # is a nasty delimiter to use in combination with /x).
Next to /, it's my default-delimiter. As I virtually never use /x, I
seldom question its use.
Tassilo