Brown
Brown

Reputation: 173

HTML5 pattern for input(mask)

( (0)|(\d{1,3})([\,])(\d{2}))

we would like get pattern for pattern 0 or number format ***,** in input, where * is number. But we cann't find options for this regexp . How syntax will be right in this case?

Thanks!

Upvotes: 1

Views: 6651

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 174957

The space at the beginning is what's causing you trouble.

<form action="foo.html">
    <input type="text" required pattern="((0)|(\d{1,3})([\,])(\d{2}))" />
    <button>Submit</button>
</form>

Upvotes: 2

Related Questions