Can anyone please advice me how to apply regex on the following String so that it returns array or any collection of items that appear in angled brackets(<>)?
77+<99>*0.5+<100>+<101>+<99>*0.5+<100>+<101>
array will contain
{99,100,101,100,101};
Thanks!
Update:(following giving no match)
// Compile regular expression
String patternStr = "(?<=<)(\\d+)(?=>)";
Pattern pattern = Pattern.compile(patternStr);
// Determine if there is an exact match
CharSequence inputStr = "77+<99>*0.5+<100>+<101>+<99>*0.5+<100>+<101>";
Matcher matcher = pattern.matcher(inputStr);
boolean matchFound = matcher.matches(); // false
System.out.println("...log..."+matchFound);
Use regex
(?<=<)(\d+)(?=>)and then remove duplicates.