html 5 pattern accepting spaces

ankitr picture ankitr · Sep 6, 2013 · Viewed 12.9k times · Source

pattern for name in HTML5

[a-zA-Z ]{5,}

Its accepting 5 times spaces.

I want a pattern that it do not accept names that start with a space

Answer

Denys Séguret picture Denys Séguret · Sep 6, 2013

Change

[a-zA-Z ]{5,}

to

[a-zA-Z][a-zA-Z ]{4,}