Yes you can do exactly that. I just wrote it the other way because I thought it would be easier for someone unfamiliar with the matcher to follow. I'm actually not sure why I used to find() method. The matches() method is actually much better suited for this task:Code:boolean is_numeric(string test) { return create_matcher("^(-?[0-9]+)((\\.?[0-9]+)?)$" , test).find(); }
		Code:
	
	boolean is_numeric(string test) {
    return create_matcher("^(-?[0-9]+)((\\.?[0-9]+)?)$" , test).matches();
}As for the negative numbers, true you could represent them like that. I wasn't aware of any restriction that said you couldn't use negative numbers in RPN though, and even if that is the case, it can't hurt to have a nice shortcut for the users, right?
You're not wrong actually. It's not just a shortcut for users either...
Here's a simple breakdown of representing -1 as 4 5 -
push 4
push 5
pop 5
pop 4
call eval_rpn
push -1
Here's a simple breakdown of representing -1 as -1
push -1
Haha, no contest?

I'm sure you could write a really small footprint implementation that uses unsigned integers but for the purposes of this, I think you're better off just pushing a negative number on the stack to begin with.
There's a lot more optimizations I can see in there that can be done, I am currently at work so I shouldn't even be here

Here's a suggestion for the is_operator function:
		Code:
	
	boolean is_operator(string test) {
    return create_matcher("\\+|-|\\*|/|\\^|if|max|min|not", test).matches();
}Happy coding!
 
	
 It really is only called when someone uses the script directly.
 It really is only called when someone uses the script directly.