On Tue, 26 Jun 2001, Yvonne Murphy <[EMAIL PROTECTED]> wrote,

<snip>

>  if ($mymatch =~  m/\'(.+)\;/gis) { #matches anything between the single
                         ^^
<snip>
>
>
> But the problem occurs when I add this into a bigger code segment, it
> just goes crazy! And seems to match te complete opposite.
>
> And ideas?

You seem to be bitten by the greedy match.  By default, the quantifiers
(such as + and *) will match as many as possible.  You need the ? to
suppress the greed behaviour.  This ? is different form the ? used to
optional unit.

    $_ = "'first; second;";
    print $1, "\n" if /'(.+);/;   # first; second
    print $1, "\n" if /'(.+?);/;  # first

Btw, /gis seems redundant to me.  So do the backslases.

hth;

__END__
-- 
s::a::n->http(www.trabas.com)

Reply via email to