This regexp:
(\d+(?:[+-/*^]\d+)+)
Allows simple expressions, not using any parenthesis but that could be easily fixed I assume. Not much time now This way you can use +, -, *, /, and ^. Just add more to the regexp.
Dont put spaces between the numbers and operators, regexp doesn't allow that yet but again, can be added. Gotta go now, mb I'll enhance it later tonight.--EDIT
Slightly improved:
(\(?\s?\d+(?:\s?[+-/*^]\s?\(?\s?\d+\s?\)?)+).
You can import it directly using this:
1000>>>FCalc>->Calculate $$1 | dosearch fc $$1>+>(\(?\s?\d+(?:\s?[+-/*^]\s?\(?\s?\d+\s?\)?)+)
This allows both parenthesis and spacing between numbers and operators. For example, this is all valid input:
1 + ( 5 * 5 )
1 + (5 * 5)
1 + (5*5)
1+(5*5)
etc.
You can ofcourse expand the equation with more operands and operators. Please note I currently do not allow for more than 1 space, but it's easily adjusted by editing each \s? (whitespace, 1 or 0 times), to \s* (whitespace, zero or
more times).
This should be sufficient for most input imho, I hope I am not forgetting something here
. Feel free to improve or (dramatically) change. Not gonna spend a lot more time on this; you can probably increase the amount of available operators (I have only included 5 now)