Skip to content Skip to sidebar Skip to footer

Regex Case Insensitive With Input Match

I am trying to make validation for an html input by assigning via javascript a regex using the following code: $('#'+field.field_id).attr('data-validation','custom'); $('#'+field.f

Solution 1:

You can use:

^([Ss][Ee][Rr][Vv][Ee][Rr] (\d{1,2}))$

to make it case insensitive.

There is no support of i (ignore case flag) in input pattern since it is compiled with the global, ignoreCase, and multiline flags disabled.

Solution 2:

This doesn't work, because you're not using open slash for regex:

^(Server (\d{1,2}))$/i

But this should work:

/^(Server (\d{1,2}))$/i

Post a Comment for "Regex Case Insensitive With Input Match"