Are there other possible email subject formats?
Are your sales orders always 7 digits?
You could use something like this:
var text string = [Subject];
//If the end of the string is a bracket, take the number from within the brackets
//Otherwise, take whatever is right of the last space
I haven't tested it, but something like that should work.