regex - Regular expression to allow single whitespace between words -
i know regular expression allow whitespace. example item name(2 words). can made of uppercase, lowercase letters , 1 whitespace. i.e word1 word2
. tried [a-za-z\sa-za-z]
doesn't work.
try this:
[a-za-z]+(\s[a-za-z]+)?
this allows 1 word, optionally followed single whitespace , word, requires whitespace character between 2 words, if present @ (ie regex allows single word).
Comments
Post a Comment