Regex To Match Two Characters Surrounding A Single Space

Category: Strings

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:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.