I’m trying to match strings that only have a, g, c or t in them (insensitive)
so the string: “AAaaatCCCc” is valid while “catb” is not.
this is my function:
var pattern = "/^[agct]+$/i";
if (!this.inputSeq.value.trim().match(pattern)){
this.errMsg = "Invalid input sequence -must contain only a,g,c or t"
updateErrorBox(this.errMsg);
}
When i enter valid strings i’m still getting the error message
Remove the quotes from the regex literal:
To:
There is an implicitly conversion
MDN
But it’s not working, because you have flags in the pattern and slashes:
/../.Could work due the implicit conversion, but case sensitive because of the missing
iflag.