[regex-coach] Re: perl regex

Edi Weitz edi at agharta.de
Fri Mar 18 22:07:10 UTC 2005


Please send questions to the mailing list.

On Fri, 18 Mar 2005 19:42:53 -0000, "Henry O'Keeffe" <hok2005 at lazydba.com> wrote:

> test.pl
>
> #!/home/perl/bin/perl
>
> $string="im not seeing any yellow";
> if ($string =~ /l*/)
>         {
>         print "Should be seeing yellow\n";
>         }
> else
>         {
>         print "Shouldn't be seeing yellow\n";
>         }
>
>
>
> $ perl test.pl
>
> Should be seeing yellow

Look closely at the screenshot you sent and you'll see the line

  "Match from 0 to 0"

Then try this:

  edi at miles:/tmp$ perl -le 'print "Match" if "xxx" =~ /l*/'
  Match
  edi at miles:/tmp$ perl -le 'print "Match: #$1#" if "xxx" =~ /(l*)/'
  Match: ##




More information about the regex-coach mailing list