Reputation: 4046
I want to remove strings in the form of the following where some-text
is a random text string.
$('#some-text').val();
I've tried various things but I think the $
sign is messing things up since it's used in regex.
Upvotes: 0
Views: 88
Reputation: 56809
To avoid escaping the special characters, you can use \Q
- \E
pair to surround the part where you want the regex engine to interpret literally:
\Q$('\E<your-regex>\Q').val();\E
Replace <your-regex>
with your regex to match the selector, or whatever it is.
Upvotes: 0
Reputation: 5473
You need to escape some characters.
Try this -
\$\('#[^']*'\)\.val\(\);
Upvotes: 1