Regular Expression notepad++ deleate comments in ( )

2

I am currently working with notepad++ and would like to deleate text between brackets togeather with the brackets themselves! I would like to use a regular expression.

Example:

(thisIsAnExample)

search and deleate (replace with nothing). [^()]* will search everything BETWEEN brackets, but not the brackets itselv. How can I do that?

user3546800

Posted 2015-09-16T12:19:38.697

Reputation: 23

Answers

1

Try this one instead of [^()]*:

\(.*?\)

[EDITED - a small explanation]

Because the ( and ) are special characters and define a groups of characters, we need to mask them with /. There are a lot of very good RegEx tutorials online for example this one.

duDE

Posted 2015-09-16T12:19:38.697

Reputation: 14 097

While this may answer the question, it would be a better answer if you could provide some explanation why it does so. – DavidPostill – 2015-09-16T12:54:02.460