• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regex Program

 
Srinivas Katta
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have executed the below Program from K&B

And the command line:
java Regex2 "\d*" ab34ef

My assumption is that the output would be 0123445 but the actual output displayed is 01234456. I do not understand how?

Thanks
Srinivas
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this FAQ.
 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
\d* eseentially implies zero or more numeric digits.

Zero length match can occur in several places and one out of it is

After the last character of source data. in your example 6 !!!

See pg 500 in K&B !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic