Hard worker
Hard worker

Reputation: 4046

Notepad++ regex replace - how to remove this string

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

Answers (3)

nhahtdh
nhahtdh

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

SMA
SMA

Reputation: 37023

Try this regex by escaping special chars:

\$\(.*\).val\(\);

Upvotes: 0

Kamehameha
Kamehameha

Reputation: 5473

You need to escape some characters.
Try this -

\$\('#[^']*'\)\.val\(\);

Upvotes: 1

Related Questions