We are working on a form validation code snippet where jQuery masking plugin has been used to enforce validation on user input.
Masking Pattern used with zip code field is 99999?-9999 where everything is optional after "?".
Problem occurs when user fill up the form using autofill feature in chrome[i.e. double click on input field and select value] and submit the form. On form submission, zip code value is coming as 23455-____ which includes masking pattern characters as well i.e. hypen & underscore.
Refer attached screenshot after using autofill feature. http://inft.ly/3mmtNdA
If optional characters contains Hypen (-) and underscore(_) then those needs to be removed before submitting it to server. I am trying to use regex but didn't find anything which checks for specific characters after 5th index item and then remove those.
Any help would be really helpful.