Forums Register Login

Regex Program

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Check this FAQ.
+Pie Number of slices to send: Send
\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 !!!
He's giving us the slip! Quick! Grab this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 810 times.
Similar Threads
doubt regarding patterns in regex
Matcher.find() -> looks one past end of String?
Pattern Matching
regex
Greedy quantifiers(*)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:13:20.