How to write parentheses in replacement, using the "Regular expression" mode ?
-
Hi, @vuvanvui-vui, and All,
@vuvanvui-vui send me an e-mail, today, saying :
hello Guy, how are you today,
hmm i have a question on notepad ++in Regular express mode i can’t replace something = “(”, “)”
exam: i want to replace: Guy = (Guy)
the () is lost in result
thanks and sorry for my bad english :DAs I think that the solution may be useful for others, I prefer to reply on our site !
Quite easy ! In the Replacement zone, you must simply escape the parentheses with the usual
\symbol ;-)). So :SEARCH
GuyREPLACE
\(Guy\)( or even\x28Guy\x29)Notes :
-
The
sixcharacters, which have to be escaped, with the backslash\symbol, are :- The backslash symbol
\ - The left parenthesis
( - The right parenthesis
) - The dollar sign
$ - The question mark punctuation sign
? - The colon punctuation sign
:
- The backslash symbol
-
The above signs have a specific meaning, in the Boost Format String library ! Just refer to :
http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html
- Most of the time, in replacement, the
$,?and:symbols do not need to be escaped !
Cheers,
guy038
-
-
thanks a lot ;)
-
Haha. This is a question I asked more than a year ago, to which guy038 also gave valuable reply.
Seriously, is there a way to edit NPP wiki? I can’t find how to register. And the Regular Expression Page is incomplete and still has some obvious errors. -
Funny enough: another same question.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login