in reply to Programmatic regex disjunction
Also, in my code the separate patterns are compiled much before the disjunction, so this is not what I’m looking for:
But that is what you get. You cannot combine the compiled forms of precompiled regexen, they must be stringified for concatenation and the result has to be recompiled. There’s no way around that.
So the last snippet is what you want. Sorry.
Btw, the stringified regexen supply their own (?:) delimitation, so all you need to do is
my $joined = do { local $_ = join '|', @any; qr/$_/; };
As an aside, you may be interested in Regexp::Assemble.
Update: added do as per gaal’s reply.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Programmatic regex disjunction
by Roy Johnson (Monsignor) on Nov 21, 2005 at 17:31 UTC | |
|
Re^2: Programmatic regex disjunction
by ysth (Canon) on Nov 22, 2005 at 04:14 UTC | |
by Aristotle (Chancellor) on Nov 22, 2005 at 08:49 UTC | |
|
Re^2: Programmatic regex disjunction
by gaal (Parson) on Nov 21, 2005 at 17:20 UTC |