develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000315.009] bug

From:
Nathan Torkington
Date:
March 15, 2000 06:17
Subject:
Re: [ID 20000315.009] bug
Message ID:
14543.39637.446913.92771@prometheus.frii.com
Ilan Bar-On writes:
> abcdddefg
> abcdddefg matches a+b* with: |ab|
> before d*: ||
> abcdddefg matches d* with: ||
> after  d*: |abcdddefg|

I'm assuming that d* is what is confusing you.

/d*/ means "0 or more d".  At the start of the string, where Perl
starts looking for a match, it finds 0 d's.  That's a match.
If you want at least 1 d, you should use /d+/.

It's not a bug, just a surprise.

Nat



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About