I am trying to change the property "pattern" of my input using jquery to a regex pattern. this is the input :
<input id="phone" pattern="[0-9()#&+*-=.]+">
I found a way, but the regex does not save the structure when inserted. this is what i have tried :
var phoneField = jQuery('#phone');
var phoneRe = "^0(?:[234689]|5[0-689]|7[246789])(?![01])(\d{7})$";
phoneField.prop("pattern",phoneRe);
the output is : ^0(?:[234689]|5[0-689]|7[246789])(?![01])(d{7})$
expected output is : ^0(?:[234689]|5[0-689]|7[246789])(?![01])(\d{7})$
to be exact (d{7})$
should be (\d{7})$