I am trying to take the value of an input text field and use it within a regular expression. Here's what I have to match the start of a line.
regex = new RegExp('^' + inputValue, 'i')
It works fine for regular strings that start have alphanumeric characters, but I am using this for dollar amounts as well. When the input field starts with a '$' (dollar sign) i get varying results.
How can I escape the variable above to be viewed as a simple string? I've tried this, but no luck:
regex = new RegExp('^[' + inputValue + ']', 'i')