When I write: "integralfrom1to10ofx^2)+integralfrom1to10ofx^3)",
I expect my regex:
// INTEGRAL BASIC
Pattern integralFinalPattern = Pattern.compile("integralfrom(.*)to(.*)of(.*)\\)");
Matcher integralFinalMatcher = integralFinalPattern.matcher(regexDedicatedString);
if(integralFinalMatcher.find()){
String integral_user_input = integralFinalMatcher.group(0);
String integral_lower_index = integralFinalMatcher.group(1);
String integral_upper_index = integralFinalMatcher.group(2);
String integral_formula = integralFinalMatcher.group(3);
String ultimateLatexIntegral = "(\\int_{"+ integral_lower_index
+"}^{"+ integral_upper_index +"} " + integral_formula + ")";
mathFormula = mathFormula.replace(integral_user_input, ultimateLatexIntegral);
}
to match these two strings separately, but for now it would interpret it as one.
And in result of it I'd get the following latex SVG:
I would like to have output with two separate integrals, like here:
How can I achieve this with regex?
Obviously, I seek for an idea that would make it work for more than two pieces.