Yes it is possible if you make your own mascara plugin with your own needs.
I have tested several and I do not know of any that works 100% in all browsers. You can even try JqueryMask , it's a very simple plug-in and well-documented plugin, but it did not answer 100% of my needs and may not meet your needs.
One workaround that I found unmasked is to describe in the placeholder element of the element how the user should fill in and supplement feedbacks with HTML attributes such as pattern HTML5, maxlength , required and others depending on the need.
Ex:
<label>CNPJ: *
<input name="cnpj" type="text" placeholder="00.000.000/0000-00" maxlength="18" required pattern="[0-9]{2}.[0-9]{3}.[0-9]{3}\/[0-9]{4}-[0-9]{2}" value="">
</label>
The advantage of doing this is that I do not need to load any additional plugins , where pattern is responsible for validating
expressions regular and give feedback to the user in real time along with the other attributes (you can also use regular expressions with Javascript for greater compatibility). Support pattern:
Can I use .
And to finish I validate the data on the server side, because only one mask on the client side is totally insecure.
For this I use the preg_match of PHP. Example:
if (preg_match("/([a-zA-Z0-9])/", $email)){return true;}
This will only accept letter and number characters.
We could create an open repository for the community and start working on a plugin that meets the needs of everyone, as I believe that even today it is missing ...