From kde-devel Tue Nov 06 05:40:44 2001 From: Michael Bedy Date: Tue, 06 Nov 2001 05:40:44 +0000 To: kde-devel Subject: Re: Fwd: Regular expression library choices X-MARC-Message: https://marc.info/?l=kde-devel&m=100503891804690 Hi, Sorry, sent the previous reply to kfm-devel instead of kde-devel. Anyway, I looked more closely at the documentation, and I see now that it does have most of the Perl stuff. It just depends which options you have selected. And it indeed does look like a nifty, full featured, C++ regular expression library. But I can think of at least three reason why I think pcre is the better choice, at least in the context of KJS: 1) It is simple. The interface to pcre is very easy to use. Maintence is really a non-issue. KJS is not doing anything remotely fancy enough to require the flexibility BOOST allows. 2) It is widely available. True, BOOST is available to download, but given that pcre seems to get installed on just about every Linux box by default now I would say libpcre is more readily available. 3) libpcre is already used by KJS (and has been for some time.) I'm just finishing the support. In fact, it's working now on my machine. I'm just cleaning it up before I check it in. (Hopefully in a couple of days.) Switching to BOOST would be additional work for no functional gain as far as JavaScript regular expressions are concerned. (Correct me if I'm wrong.) Don't get me wrong, I love whiz-bang C++ interfaces to things, and the BOOST stuff looks cool. I just don't think using it is the best solution in this case. - Mike On Mon, 5 Nov 2001, Rob Gillen wrote: > Hi Mike, > > I'm not too sure where you are getting the idea that the syntax that is > used in regex++ leans more towards POSIX. It *provides* POSIX > compatibility for older regular expression library uses (primarily > because it is more than twice as fast than those libraries (GNU/BSD > regex). However, much of it has been inspired from Perl regular > expressions. In fact, as I said in the thread on the KDE-Devel mailing > list, the only thing that I see missing from the regex++ syntax that is > in the normal Perl 5 syntax (upon which ECMAScript RegEx objects are > modelled) is positive and negative lookahead assertions: > > (?=...) positive lookahead assertion > (?!...) negative lookahead assertion > > These are, at least in my experience, used very infrequently. There are > occasions where they do come in handy, but the average Javascript > programmer (which I'm assuming this is to be used for) probably isn't > going to be using these too often. Most of the time, regular expression > objects are used to validate data in forms before submission. > > Can you give me an example of a regular expression syntax that you think > would not work under regex++? I've taken a look at the ECMAScript-262 > Language Spec (ftp://ftp.ecma.ch/ecma-st/Ecma-262.pdf), and I really > haven't found anything besides the caveats that I mentioned. > > Perhaps I am being too persistent in pushing a C++ lib. But I still > feel that a C++ library is going to be more extensible, and probably in > the long run, more maintainable than a C library. There has been some > mention of compiler concerns on the Dev mailing list, but if you > [really] check out the documentation for building it, you'll see that it > covers a wide variety of platforms and compilers. The other positive is > that many of the libraries in Boost are likely candidates for induction > into future C++ standards. > > Rob > > > > Michael Bedy wrote: > > > Hi, > > > > The problem is that we need to follow the Javascript spec as far as the > > format of regular expressions go. It looks like (from a cursory glance at > > the web page) the BOOST library leans more towards the POSIX syntax. > > Unfortunatly, that's exactly what I am trying to get rid of by moving to > > pcre. > > > > So, the library we are using is dictated by the JavaScript standard - > > which happens to use Perl format regular expressions. Pcre provides an > > implementation of perl regular expressions. > > > > Thanks, > > - Mike > > > > P.S. I've got it working, but I'm still trying to figure out error > > handling. Getting there, though. > > > > On Mon, 5 Nov 2001, David Faure wrote: > > > > > >>Hi, > >> > >>In case nobody forwarded this to you yet... > >> > >>---------- Forwarded Message ---------- > >> > >>Subject: Regular expression library choices > >>Date: Fri, 02 Nov 2001 12:29:04 -0500 > >>From: Rob Gillen > >>To: KDE Development Mailing List > >> > >>It's been a while since I actively followed the mailing list here, but I > >>just finished reading the most recent Kernel Cousin KDE and noticed the > >>tidbit on regular expression library choices (PCRE and QRegex). Has > >>anyone considered using the native C++-developed Regex++ that is in the > >>free Boost C++ library? I've used this library before, and it is very > >>fast, feature complete, extensible, and compatible with standard C++. > >> > >> http://boost.org/libs/regex/index.htm > >> > >>If I sound like a commercial, I apologize only partly. I don't want to > >>burn bandwidth unnecessarily, but I am very picky about regular > >>expressions and I've used quite a few different implementations. > >> > >>Rob > >> > >> > >> > >> > > > > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<