Closed jakob-stark closed 2 years ago
I believe this behavior may have changed sometime, because matches()
was just intended to report a match yes/no. The doc isn't updated. But I agree it is nicer to have the group capture index. Will update the repo with the change to return capture index.
Note that you can also get the capture index afterwards with Matcher::accept()
.
Thanks for the answer and also for the awesome project. I guess I'm just fine to use Matcher::accept()
but would also appreciate a future change. After all the return value still could be used as a boolean value if it returned the group capture index.
Fixed in v3.2.2.
The manual states:
Almost the same is said for the
scan()
method. Now consider the following programIt prints out
So the
scan()
method actually returns the group capture index value as stated in the manual, but thematches()
method does not. Is this behaviour intended?