简体   繁体   中英

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.

You need to escape some characters.
Try this -

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

通过转义特殊字符来尝试此正则表达式:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM