I need a regex for a string containing characters only with zero or more spaces allowed in between. But preceding and trailing spaces are not allowed.
I came up with this regex: /^[a-zA-Z]+(\s*[a-zA-Z]+)*$/
But I also need total length of the string between 2 to 30.
For that I tried using Range Quantifier like : /(^[a-zA-Z]+(\s*[a-zA-Z]+)*){2,30}$/
But this does not seem to work. What could be wrong?