In JavaScript, we add /gto the string without quotes to indicate a regular expression.
What if I have a string in a variable and want to use it as a regular expression?
Is it possible? If so, can someone show me some sample code?
Thank.
source
share