I'm a beginner in node.js so please do excuse me if my question is foolish. As we know we can use
var regex = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/g;
regex.test(str);
to check whether a string contains special charecters or not .But what I'm asking is how to check for only a particular charecter means how can I check only presence of #
.
I tried to do
var regex = /[#]/g; regex.test(str)
.
Although it's not working but are there any other method of doing this?