Hi All,
Please find the code below to identify Special Character in a String.
var valuewithSpecialCharacter ="yourname\name"
var findSpecialCharacterinDomainName = 0;
for (i = 0; i <= valuewithSpecialCharacter.length; i++) {
if (/^[a-zA-Z]+$/.test(valuewithSpecialCharacter[i])) {
findSpecialCharacterinDomainName += 1;
} else {
break;
}
}
Note:
You will get Output Count findSpecialCharacterinDomainName.
Note:
You will get Output Count findSpecialCharacterinDomainName.