Regex To Match Two Characters Surrounding A Single Space

A Regular Expression to match two characters surrounding a single space, with support for enforcing a minimum and maximum number of characters (2-5 characters in this regex).

/([a-zA-Z]\s){2,5}/

Matches:

  • a b c d e c d e
  • a b 
  • regexpattern

Non-matches:

  • regex pattern
  • regexpattern com

See Also: