igorescobar / jQuery-Mask-Plugin

A jQuery Plugin to make masks on form fields and HTML elements.
http://igorescobar.github.io/jQuery-Mask-Plugin/
Other
4.77k stars 1.42k forks source link

Can i do this kind of mask ? #796

Open rafaelbuntu opened 1 year ago

rafaelbuntu commented 1 year ago

I have a search field to search in my list and i have a resource to find two numbers or more like:

productID: 2274124 [or] 2274123 [or] 1284552

I found this great plugin and iam trying to use the number mask to the search field and i cant make this works. The search must match only numbers and the brackets [ with any word inside ] see my failed test

$('#my-search-field').mask("X", {
    translation: {
        'X': {
            pattern: /([0-9])|(\[.*?\])/g,
            optional: true,
            recursive: true
        }
      }
});