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

Re: [ID 20000315.009] bug

Nathan Torkington
March 15, 2000 06:17
Re: [ID 20000315.009] bug
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About