Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a portable and lightweight C/C++ regular expression library? [closed]

Tags:

c++

c

regex

Possible Duplicate:
Lightweight and portable regex library for C/C++?

I'm looking for a C++ (C is acceptable, too) library for matching regular expressions. The library should satisfy these requirements:

  • Can be built on Windows (MSVC 7 and newer)
  • Can be built on Linux (g++ 3.4 and newer).
  • Has no external dependencies; nothing but C/C++ runtime and STL allowed
  • Works reasonably fast for small (~200 characters) strings to match against

I don't need a particular regexp flavor (POSIX, PCRE etc.) so anything is fine.

So far, I considered these libraries:

  • re2: Interesting, but apparently no support for Windows builds
  • PCRE doesn't seem terribly 'small' (over 1MB zipped sources) and doesn't seem to support Windows in its buildsystem.
  • Boost Regex might fit the bill but I didn't spend much time on trying to figure out if I can build it standalone

Anything else maybe?

like image 657
Frerich Raabe Avatar asked Dec 23 '22 01:12

Frerich Raabe


2 Answers

A quick Google for "pcre windows" seems to say that it does, in fact, support Windows. The .so file on my system is < 200 KiB, so it doesn't seem to take up that much disk space either...

like image 187
Thanatos Avatar answered Apr 19 '23 23:04

Thanatos


Try the GNU regex library.

http://www.gnu.org/s/libc/manual/html_node/Regular-Expressions.html

There's been at least one windows port:

http://people.delphiforums.com/gjc/gnu_regex.html

like image 21
Dagg Nabbit Avatar answered Apr 20 '23 00:04

Dagg Nabbit