I need to capture a repeated pattern inside a line.
For instance :
toto#titi#
or toto#titi#tutu
or toto#titi#tutu#tata#
etc...
and this is my regex : (?:[\w]*#){1,}
And I need to capture toto, titi, tutu...
But even if Matcher.matches()
returns true, the only group I have is the last captured pattern :
toto#titi#
-> 1 group titi
, toto#titi#tutu
-> 1 group tutu
, toto#titi#tutu#tata
-> 1 group tata
.
Could you tell me why and how to solve it?
Many thanks
Adrien