} else{
NSLog(@"Bad format for equation in Objective");
NSLog(equation);
}
I want to match any linear equation using the regex regexFormat. It
works in most cases ( ie, it matches what I want and does not match
what I don't), except that it does match X1+2X2++3X3, which is quite
worrying. In addition to this, it does not match neither X1+2X2++X3
nor X1 +2X2++3.1X3.
I have done all the manipulations that came to my mind to check it and
it looks like the presence of a integer ( and not floating)
coefficient in front of a variable which is not the first one in the
equation allows a double + in front of it. It also works with +- but
does not work with more than two +.
Finally, I have tried it in python ( see code below ), and it does
exactly what I want. Do you think there could be an issue with regexes
using NSPredicate ?