I'm working on form based on material-design-lite plugin. Link below: https://getmdl.io/components/index.html#textfields-section
I have a problem with form validation, especially with regular expression.
There is my simple form:
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="sample4">
<label class="mdl-textfield__label" for="sample4">Number...</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
</form>
I would like to have such validation patterns:
- Input amount is not a string (only number 0-9)
- Separator must be ","
- I need max 2 decimal places
- I can't accept any characters, except of numbers 0-9 and ","
- Input amount cannot be less than 0
- Input amount has to start from a number
Could you please help me with these regular expressions? I don't have enough knowledge about it, just need ready patterns. Rest of validation I'm going to do via javascript.
Thank you!