Is there an easy way to check if the first and last characters of a string are the same or not, only with a regular expression?
I know you can check with charAt
var firstChar = str.charAt(0);
var lastChar = str.charAt(length-1);
console.log(firstChar===lastChar):
I do not ask for this: Regular expression to match the first and last character
Milad source
share