How do extract values from a regex where any placeholder can be rederenced by a $number_of_occurance value?
For example, I have a string final_0.25Seg1-Frag1 and I want to find all matches of this string in a file with 0.25 as a wildcard, which I can do using
Pattern regex = Pattern.compile( "/vod/final_\\d+\\.\\d+Seg1-Frag1" );
Matcher regexMatcher = regex.matcher(data2[0]);
I want to retain the value of the value in \\d+\\.\\d and find which among all the matched lines has the biggest value in this position.
Have you looked at Pattern groups ? You can iterate through these to identify matched subexpressions.
From the linked example. Matcher.group(0) is the complete expression.