Try this:
my $stringToMatch = "hello";
my $runtimeRegExp = "he";
print $stringToMatch." world" if($stringToMatch =~ /$runtimeRegExp/gi);
At 09:23 22.05.2001 -0400, you wrote:
>Hi people,
>
> I need to match string against regular expressions that are only
>known at run-time. I'm having
Good day;
See below for what I think may be the issues...Haven't tried it out before,
but hope this helps.
At 09:23 AM 5/22/2001 -0400, Robin Lavallee (LMC) wrote:
>Hi people,
>
> I need to match string against regular expressions that are only
>known at run-time. I'm having problems do
Robin Lavallee wrote:
: On the command lines, the following happend
:
: allo al => match
: allo /al/ => no match (should match, no ?)
No, because "allo" doesn't contain any slashes.
: allo lo$ => match
: allo ^al => match
: allo ^ao$
Just wanted to point out that the pair:
allo ^ao$
doesn't work, because this regex matches "ao" on a line by itself. you
would have to perform two matches, one for "^a" and another for "o$" in
order to match te string "allo" this way. As for why the '/' doesn't
cooperate, it has to do with the