PHP preg_match needed to ensure only ONE space character is allowed between words

后端 未结 3 1758
广开言路
广开言路 2020-12-11 23:47

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:

3条回答
  •  佛祖请我去吃肉
    2020-12-12 00:30

    i think to specify a number of occurences to your match you put i.e{1} {1,5} (to match only 1 or between 1 and 5 inclusive) so something like...

    ^[A-Za-z]+( {1})$

提交回复
热议问题