What standard for Regular Expressions is Notepad++ using?
-
Hi,
I have been using Notepad++ for occasional general editing for a couple of years, and find it very useful.I am starting to explore regular expressions but I have no reference for the regular expression terms or syntax. Can someone point me at a reference for the regular expressions used in Notepad++?
My baseline for Regular Expressions is on Edit/1000 under RTE/A for HP Minicomputers (1985) and early HPUX, but nothing for the last 20 ish years as I only dabble in Unix/Linux … I saw the syntax change quickly in the early days but do not know if it has stabilised into a common format by now …
Thanks,
Tony. -
You will find an exhaustive discussion of the Notepad++ regular expression “flavor” here:
https://notepad-plus-plus.org/community/topic/9703/is-it-planned-to-switch-to-pcre2Perhaps that contains a deeper treatment than you want/need. Basically N++ currently uses the BOOST implementation, and these TWO links, which are buried in the above link, are very helpful in understanding Notepad++'s regexes:
SEARCHING:
http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.htmlREPLACING:
http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html -
Hi Scott,
Thanks for the help.
I have all my editting done except for deleting lines.
From the command line I would use something like:
1$f/^“”/,d
to search the file, find all occurrences of 2 quotes at the start of a line, and then delete that line. Repeat until end of file.I cannot see if there is a facility to drop into a command line, nor can I find a delete option in the Search/Replace menu.
Can you tell me what I am missing?
Thanks,
Tony -
Hello Tony,
You can get this action, by two means, with Notepad++ :
-
by performing a simple Search and Replace operation, in regular expression mode
-
by deleting all the bookmarked lines, which contain two double quotes, at the beginning of each line
First method :
-
Open the Replace dialog ( CTRL + H )
-
SEARCH
^"".*\R -
REPLACE
Nothing -
Check the Wrap around option
-
Check the Regular expression search mode ( Important )
-
UNCHECK the .matches newline option, if necessary
-
Click on the Replace All button
Notes :
-
^is an assertion, that represents the location between the last EOL character of the previous line and the first character of the current line -
.*then matches the rest of the line, after the two double quotes -
\Rstands for any kind of EOL characters (\r\n, for Windows files,\n, for Unix files or\rfor old Mac files ) -
As the replacement zone is empty, then, the entire lines, containing
"", at beginning of lines are deleted
Second method :
-
Open the Mark dialog ( Menu Search - Mark… )
-
SEARCH
^"" -
Check the Bookmark line option
-
Check the Wrap around option
-
Check the Regular expression search mode ( Important )
-
UNCHECK the .matches newline option, if necessary
-
Click on the Mark All button
-
Select the menu option Search - Bookmark - Cut Bookmark Lines
Best Regards,
guy038
-
-
Hi guy038,
I had used part of your first example - I used search for ^“”, but missed the rest of the line. Using the complete expression worked fine.
Many thanks,
Tony
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