質問

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

役に立ちましたか?

解決

Change

[a-zA-Z ]{5,}

to

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

他のヒント

This worked for me

pattern="^[a-zA-Z]+(\s[a-zA-Z]+)?$"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top