Regular expression to allow single whitespace between words

regex

Solution

Try this:

[A-Za-z]+(\s[A-Za-z]+)?

This allows one word, optionally followed by a single whitespace and another word, which requires the whitespace character to be only between two words, if present at all (ie the regex also allows for just a single word).

Problem

I would like to know a regular expression to allow whitespace. My example is an item name(2 words). It can be made of uppercase, lowercase letters and one whitespace. I.e `word1 word2`. I tried with `[A-Za-z\sA-Za-z]` but it doesn't work.

Original source