Inputmask
Inputmask copied to clipboard
Regex removes leading 0 and it some cases leaves it in place
I wanted to create a mask with a required start of the string and tried this (used for local phone-numbers which always start with "06-"):
Inputmask({regex: "\\06-\\d{8}"}).mask(container.querySelectorAll("input[data-inputmask-phone]"));
This almost does what I need, except that it removes the leading 0 (tried this with input type of text and number). However, when I change the 06 in the regex to 09, it does leave the leading 0 in place:
Inputmask({regex: "\\09-\\d{8}"}).mask(container.querySelectorAll("input[data-inputmask-phone]"));
Is this a bug or Is there a way around this so I get "06-" instead of "6-"?
Example of both: https://codepen.io/DBZFYAM/pen/VwXdbrM
Using version 5.0.7