regex - HTML5 Form Input Pattern Currency Format -
using html5 have input field should validate against dollar amount entered. have following markup:
<input type="number" pattern="(\d{3})([\.])(\d{2})">
this works great amount greater 100.00 , less 1,000.00. trying write pattern (regex) accept amount less dollar , greater dollar. maybe upwards of 100,000.00. possible?
any appreciated! :)
regards, ben
if want allow comma delimiter pass following test cases:
0,00 => true 0.00 => true 01,00 => true 01.00 => true 0.000 => false 0-01 => false
then use this:
^\d+(\.|\,)\d{2}$
Comments
Post a Comment