It should be very powerful to have find / replace / regexp features like EditPadPro. I mean: multiline searches, effective regexps (that should use the Perl syntax), possibility to set quantifiers as greedy or lazy, incremental search by default.
You have most of it using TextFX -> TextFX Toools -> Find/Replace.
The only thing you don't get is Perl-compatible regexes, but someone claimed having been able to graft pcre.dll onto Notepad++. I think it was in ocobrt-november 2008. Try searching this forum for "pcre" around that time.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Mmmh... it's not the same. First, TextFX is an useful plugin, but it's messy. Second, it uses a classic window for Find & Replace, instead of an incremental search style, more pratical.
PCRE seems to be an optimal solution, since Perl syntax is widely diffused, it is a "popular" library, it's written in C/C++ so is compatible with Notepad++ code, and it's full of features.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I agree with you re PCRE. However, I looked into incorporating it into Notepad++ a while ago, and if I recall correctly, the problem was that Notepad++ expects the matching to be done line-by-line, while PCRE expects the entire document. I could find no way to reconcile the behaviors. Perhaps a better developer can come up with a solution. Anyone?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In nov 2008 using PN SciLexer.dll in npp had some glitches. Today I tried SciLexer.dll from PN 2.0.10 in npp 5.5 and at a first glance it seems to work. Just give it a try.
Gerd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, now I have a Scintilla 2.0.1 with boost::xpressive running with my npp 5.5. Here's what to do:
- Obtain (http://www.scintilla.org/ScintillaDownload.html) and make sure it builds "as is"
- Obtain (http://www.boost.org). This will only use xpressive, so just unpack it to a folder of your choice.
- Obtain RegexSearch.cpp from (http://code.google.com/p/pnotepad/source/browse/branches/rel-2-0-10/scintilla)
- Store it in src folder of your scintilla and change extension to .cxx
- Alter implementation of CreateRegexSearch to match the one from Document.cxx namespace-wise.
- In scintilla makefile add your boost folder to the include pathes and add SCI\_OWNREGEX and \_SCL\_SECURE\_NO\_WARNINGS to the buildflags
- In scintilla makefile add rule to build RegexSearch.obj from RegexSearch.cxx
- In scintilla makefile add RegexSearch.obj to SOBJS and LOBJS
- Start build
- Drop SciLexer.dll in npp installation folder
This is completely untested at the moment so please be careful. And of course a big "thank you" to (www.pnotepad.org) who is the developer of Programmer's Notepad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any chance of seeing this incorporated into the official releases of Notepad++? This would truly be the last killer feature that npp lacks compared to so many other editors.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Bragradon, if you are still around, could you contact Don about this?
Are you using Boost? This is a huge dependency and including it in N++ is not quite desirable.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
gerdb42 is the person who originated this method, so he might be better suited to answering questions.
I just followed his instructions above.
However, I can clarify a few things.
There is a Boost dependency but only on the Xpressive library. I am not sure the dependencies of Xpressive.
Can you explain why the resistance of using Boost?
The scintilla DLL from 5.6.8 is: 463,630 bytes
The patched DLL i use is: 700,416 bytes
When I compiled the regex support into the scintilla dll I used the following software:
Boost 1.40
Scintilla 2.01
RegexSearch.cpp from revision aeb00ff2d6 (Nov 01, 2009)
I'm still on NPP 5.6.8 as 5.7 uses a newer scintilla (and each upgrade clobbered my dll)
I'll try make a new dll with latest version of the above.
If i confirm things still work, should I contact Don.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes please, with some details about what are the exact parts of Boost being drawn upon at compile time. He once told me that seemed to be a much too huge addition. I'm not expert enough in C and dll's to take a look by myself - I probably should.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the sizes reported by bragradon match my experience. Using boost::xpressive does not add any runtime-dependency. It has some compile-time dependencies to other boost libraries as well as to STL.
Ok, a 50% increase in size _is_ something, but ~250KB is a price I'm willing to pay. Or are you referring to distributing boost with the npp source? This would indeed be way too huge. But I think distributing boost along with npp is neither necessary nor desirable since people who want to do their own build of npp may already have the libraries on their system.
IMHO the main point is to have boost::xpressive searches in the binary distribution so people can have it by simply installing npp.
Gerd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The advantage was that Simon Steele already had an implementation of advanced regex search for scintilla and I just dropped it in instead of re-inventing the wheel again :-). And his implementation happened to use boost::xpresssive.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's easy enough to implement a different regex engine to Scintilla, so rather than take one that exists just because it exists, it sounds like it's worth doing a proper comparison of the various libraries, in terms of features, size, speed, bulk etc, and then doing an implementation for that. I'd be quite happy to provide a downloadable SciLexer.dll with the changes in, until such time as it makes it into the official release.
I'll happily set up a poll somewhere - the options I know about for regex are:
boost::regex (boost)
PCRE (originally from exim)
re2 (google, no backreferences or zero length generalized assertions, implemented with automaton)
irregexp (chrome, also automaton based but supports backreferences and zero length generalized assertions)
If you know of any other alternatives, or have any corrections to my hastily-gathered information above, please comment. I'll set up a vote when we've got the options. (I'm away for a couple of weeks now though, so it won't be just yet).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
TRegExp Delphi library written by Andrey V. Sorokin <anso@mail.ru>. It can be downloaded from http://anso.da.ru (http://anso.virtualave.net).
It ships with ConTEXT, and it is very convenient imho.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just confirming that this method still works.
I recompiled the SciLexer.dll with VS2010 and it came to 727,040 bytes
Boost 1.43
Scintilla 2.12
RegexSearch.cpp from revision 6c92a56df7 (Jan 11, 2010 )
As for davegb3 suggestion on looking at different libraries, I'm not opposed to doing this (though I have very little time to help atm). What would be the features we would want? With Boost::Xpressive, for me at least, the speed is fine. and feature wise it almost matches PCRE: Wikipedia comparison
Also, I'm not too familiar with the licence NPP uses but is it compatible with the licenses of these libraries? Since I don't know, I haven't posted the dll for download.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually I knew boost::regex and boost::xpressive before I came across Simon's integration with scintilla and the rich feature set was another point which convinced me to try it for npp.
Another point to consider is that while boost's libraries (and probably PCRE) integrate seamlessly (no external dependencies, only a larger SciLexer.dll), especially automation-based tools may create cross-app dependencies.
BTW: RegexSearch.cpp also integrates well with the slightly-patched scintilla from npp, so the original scintilla is not a requirement.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
N++ and Scintilla are under GPL 2 or later, so the requirements are simply to clearly mark the changes and give credit to whom it's due. Informing the authors, while not always required, is probably good for karma too.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It should be very powerful to have find / replace / regexp features like EditPadPro. I mean: multiline searches, effective regexps (that should use the Perl syntax), possibility to set quantifiers as greedy or lazy, incremental search by default.
You can see what I mean with the demo:
http://download.jgsoft.com/editpad/SetupEditPadProDemo.exe
Try contacting gerdb42, he claimed he achieved this in nov 2008.
CChris
You have most of it using TextFX -> TextFX Toools -> Find/Replace.
The only thing you don't get is Perl-compatible regexes, but someone claimed having been able to graft pcre.dll onto Notepad++. I think it was in ocobrt-november 2008. Try searching this forum for "pcre" around that time.
CChris
Mmmh... it's not the same. First, TextFX is an useful plugin, but it's messy. Second, it uses a classic window for Find & Replace, instead of an incremental search style, more pratical.
PCRE seems to be an optimal solution, since Perl syntax is widely diffused, it is a "popular" library, it's written in C/C++ so is compatible with Notepad++ code, and it's full of features.
I agree with you re PCRE. However, I looked into incorporating it into Notepad++ a while ago, and if I recall correctly, the problem was that Notepad++ expects the matching to be done line-by-line, while PCRE expects the entire document. I could find no way to reconcile the behaviors. Perhaps a better developer can come up with a solution. Anyone?
In nov 2008 using PN SciLexer.dll in npp had some glitches. Today I tried SciLexer.dll from PN 2.0.10 in npp 5.5 and at a first glance it seems to work. Just give it a try.
Gerd
Forgot to mention: Programmer's Notepad uses boost::xpressive (PCRE compatible) as RegEx engine.
Ok, now I have a Scintilla 2.0.1 with boost::xpressive running with my npp 5.5. Here's what to do:
- Obtain (http://www.scintilla.org/ScintillaDownload.html) and make sure it builds "as is"
- Obtain (http://www.boost.org). This will only use xpressive, so just unpack it to a folder of your choice.
- Obtain RegexSearch.cpp from (http://code.google.com/p/pnotepad/source/browse/branches/rel-2-0-10/scintilla)
- Store it in src folder of your scintilla and change extension to .cxx
- Alter implementation of CreateRegexSearch to match the one from Document.cxx namespace-wise.
- In scintilla makefile add your boost folder to the include pathes and add SCI\_OWNREGEX and \_SCL\_SECURE\_NO\_WARNINGS to the buildflags
- In scintilla makefile add rule to build RegexSearch.obj from RegexSearch.cxx
- In scintilla makefile add RegexSearch.obj to SOBJS and LOBJS
- Start build
- Drop SciLexer.dll in npp installation folder
This is completely untested at the moment so please be careful. And of course a big "thank you" to (www.pnotepad.org) who is the developer of Programmer's Notepad
Oops, I screwed the last url so please have a look (http://www.pnotepad.org).
gerdb42,
Thanks for the instructions.
I had some difficulty with the line
"Alter implementation of CreateRegexSearch to match the one from Document.cxx namespace-wise."
but managed to fix it by adding the SCI_NAMESPACE flag.
I tested with the regex ^1?$|^(11+?)\1+$ and everything appears to work
Any chance of seeing this incorporated into the official releases of Notepad++? This would truly be the last killer feature that npp lacks compared to so many other editors.
Same here.
Can everyone include this, if it works?
I got very angry as I discovered that my RegEx isn't working though it's correct.
Kind Regards
Bananen-Joe
Bragradon, if you are still around, could you contact Don about this?
Are you using Boost? This is a huge dependency and including it in N++ is not quite desirable.
CChris
Hi cchris,
gerdb42 is the person who originated this method, so he might be better suited to answering questions.
I just followed his instructions above.
However, I can clarify a few things.
There is a Boost dependency but only on the Xpressive library. I am not sure the dependencies of Xpressive.
Can you explain why the resistance of using Boost?
The scintilla DLL from 5.6.8 is: 463,630 bytes
The patched DLL i use is: 700,416 bytes
When I compiled the regex support into the scintilla dll I used the following software:
Boost 1.40
Scintilla 2.01
RegexSearch.cpp from revision aeb00ff2d6 (Nov 01, 2009)
I'm still on NPP 5.6.8 as 5.7 uses a newer scintilla (and each upgrade clobbered my dll)
I'll try make a new dll with latest version of the above.
If i confirm things still work, should I contact Don.
Yes please, with some details about what are the exact parts of Boost being drawn upon at compile time. He once told me that seemed to be a much too huge addition. I'm not expert enough in C and dll's to take a look by myself - I probably should.
CChris
Hi CChris,
the sizes reported by bragradon match my experience. Using boost::xpressive does not add any runtime-dependency. It has some compile-time dependencies to other boost libraries as well as to STL.
Ok, a 50% increase in size _is_ something, but ~250KB is a price I'm willing to pay. Or are you referring to distributing boost with the npp source? This would indeed be way too huge. But I think distributing boost along with npp is neither necessary nor desirable since people who want to do their own build of npp may already have the libraries on their system.
IMHO the main point is to have boost::xpressive searches in the binary distribution so people can have it by simply installing npp.
Gerd
Maybe it's just me, but I don't see the advantage of boost::xpressive over boost::regex (or PCRE, or irregexp, or….)?
boost::xpressive looks very powerful when there are compile time regex's, but we're dealing solely with runtime, aren't we?
The advantage was that Simon Steele already had an implementation of advanced regex search for scintilla and I just dropped it in instead of re-inventing the wheel again :-). And his implementation happened to use boost::xpresssive.
It's easy enough to implement a different regex engine to Scintilla, so rather than take one that exists just because it exists, it sounds like it's worth doing a proper comparison of the various libraries, in terms of features, size, speed, bulk etc, and then doing an implementation for that. I'd be quite happy to provide a downloadable SciLexer.dll with the changes in, until such time as it makes it into the official release.
I'll happily set up a poll somewhere - the options I know about for regex are:
boost::regex (boost)
PCRE (originally from exim)
re2 (google, no backreferences or zero length generalized assertions, implemented with automaton)
irregexp (chrome, also automaton based but supports backreferences and zero length generalized assertions)
If you know of any other alternatives, or have any corrections to my hastily-gathered information above, please comment. I'll set up a vote when we've got the options. (I'm away for a couple of weeks now though, so it won't be just yet).
TRegExp Delphi library written by Andrey V. Sorokin <anso@mail.ru>. It can be downloaded from http://anso.da.ru (http://anso.virtualave.net).
It ships with ConTEXT, and it is very convenient imho.
CChris
Just confirming that this method still works.
I recompiled the SciLexer.dll with VS2010 and it came to 727,040 bytes
Boost 1.43
Scintilla 2.12
RegexSearch.cpp from revision 6c92a56df7 (Jan 11, 2010 )
As for davegb3 suggestion on looking at different libraries, I'm not opposed to doing this (though I have very little time to help atm). What would be the features we would want? With Boost::Xpressive, for me at least, the speed is fine. and feature wise it almost matches PCRE: Wikipedia comparison
Also, I'm not too familiar with the licence NPP uses but is it compatible with the licenses of these libraries? Since I don't know, I haven't posted the dll for download.
Actually I knew boost::regex and boost::xpressive before I came across Simon's integration with scintilla and the rich feature set was another point which convinced me to try it for npp.
Another point to consider is that while boost's libraries (and probably PCRE) integrate seamlessly (no external dependencies, only a larger SciLexer.dll), especially automation-based tools may create cross-app dependencies.
BTW: RegexSearch.cpp also integrates well with the slightly-patched scintilla from npp, so the original scintilla is not a requirement.
N++ and Scintilla are under GPL 2 or later, so the requirements are simply to clearly mark the changes and give credit to whom it's due. Informing the authors, while not always required, is probably good for karma too.
CChris