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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -