I have strings like below:
@property.one@some text here@property.two@another optional text here etc
which contains @.+?@ strings inside.
I’d like to capture all these “variables” into groups via one regexp matching but it seems like it’s not possible as regexp returns only last captured group while repeating.
You’re right; most regex flavors, Java included, do not allow access to individual matches of a repeated capturing group. (Perl 6 and .NET do allow this, for the record, but that’s not helping you).
What else can you do?
That will capture
@property.one@,@property.two@etc. one by one.