basically I need a preg_match that ensures that only one space character is allowed between each word (IF there is more than one word).
My existing rule is:
(^[A-Za-zs]+$)
Thanks.
It depends what you mean by "word", but assuming you mean letters in A-Z or a-z you can try this:
^[a-zA-Z]+( [a-zA-Z]+)*$
Note that s does not mean the space character - it means any whitespace, including a new line.
s
2.1m questions
2.1m answers
60 comments
57.0k users