I'm using jQuery to add a pattern attribute to a text field based on a letter I select from an array. I'm trying to restrict the values that text field can accept with a regex, but it doesn't work properly.
What I want is that the first char of the value must be the letter I choose of the array, and then don't accept more than 2 identical consecutive caracters.
My regex is this:
^["+letter+"](?!(.)\1).{2}.*
And it seems to work when I'm testing it in regexr.com, but when I test it in my page, just the part of match the 1st char works, and the rest don't. When I type something like "Aaaaron", the message of "invalid entry" doesn't show.
Thanks in advance.