I'm having an issue with a regular expression that works fine when tested online.
^(?![.])^[.a-zA-Z0-9]*(?<!\.)$
You can test it here: https://regex101.com/r/bomm5g/1/
However, when I incorporate the regex into my code, I encounter the following error:
Invalid regular expression: /^(?![.])^[.a-zA-Z0-9]*(?<!.)$/: Invalid group
The code snippet causing the issue is as follows:
var regex = new RegExp("^(?![.])^[.a-zA-Z0-9]*(?<!\.)$");
regex.test(inputvalue);
Any suggestions on how to make this work?