0

I am trying to validate an input field using the following pattern but i get this error :

<input id="testMyU" type="text" required maxlength=35 pattern="((?!((&[^\ ]*;))|([<>])).)*" >

Error :

Pattern attribute value ((?!((&[^\ ]*;))|([<>])).)* is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /((?!((&[^\ ]*;))|([<>])).)*/: Invalid escape

I don't find my mistake ...

wawanopoulos
  • 9,614
  • 31
  • 111
  • 166

1 Answers1

2

Your problem is here:

<input id="testMyU" type="text" required maxlength=35 pattern="((?!((&[^\ ]*;))|([<>])).)*" >
                                                                        ^

Try using a double backslash.

ThePerplexedOne
  • 2,920
  • 15
  • 30