Deshal Kh
Deshal Kh

Reputation: 253

How to create pattern in input in html allowing only number and two special character?

Here is my code. From this code I can create pattern which allow only number and two special character # and *. But I can't control space. I need to restricted space usage in this input.

<input type="text" name="country_code" pattern="^[0-9#* ]+$" >

Upvotes: 1

Views: 188

Answers (1)

Yusuf Kapasi
Yusuf Kapasi

Reputation: 587

check this regex for your requirement, you need to use

"^[0-9#*]+$"

Upvotes: 1

Related Questions