I would like to create a regex that will validate that a string is an equation made up of a **single** digits and either the `*` or `+` operator and is no longer than 100 characters. So these would be valid:
1+2*3*8+0
9
9*9
And these would **not** be valid:
1++1
12+1
2*25
1+
47
+
+1
11
I came up with the regex below to accomplish this:
^(\d{1}[\+\*]{1}){0,99}\d$
Which *appears* to work, but I'm curious if there is a cleaner way to accomplish this. Any suggestions or is this about as clean as it gets?
It is saved [here][1] if you would like to play with it.
[1]: http://regexr.com/3cune