Which of these characters need to be escaped for a regular expressions search to work properly?

I need the following characters to be taken literally:

"><=/_-.

Which of them need to be escaped?

I also need the following string to be taken literally:

" />

Is there anything special I need to do, due to the numbers?

I'm doing a regular expressions find & replace.

I appreciate any help.

1

2 Answers

Depending on what type of regex is being used (PCRE, .NET, ... whatever) the special characters may differ. If you go to

and select the software and type of regex evaluator at upper left, the page will tell you what characters must be escaped, and in most cases, how to escape them. You can always use an ASCII octal alternation, even though it may be ugly (note that this is an example and does not match your provided characters):

[\032|\060|\061\062]

Then test it, as Seth says, using one of the online regex testers.

1

Notepad++ uses Boost regex flavour.

Boost documentation.

From this list of characters "><=/_-., only . have to be escaped.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like