What is a portable and lightweight C / C ++ regular expression library?

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

I am looking for a C ++ library (C also acceptable) for matching regular expressions. The library must meet the following requirements:

  • Can be built on Windows (MSVC 7 and later)
  • It can be built on Linux (g ++ 3.4 and later).
  • It has no external dependencies; nothing but the C / C ++ and STL runtimes allowed
  • Works fast enough for small (~ 200 characters) lines to match

I donโ€™t need a special regexp taste (POSIX, PCRE, etc.), so everything is in order.

So far I have been looking at these libraries:

  • re2 : Interesting, but apparently Windows support doesn't build
  • PCRE does not look terribly โ€œsmallโ€ (more than 1 MB with a zipper) and does not seem to support Windows in its buildsystem.
  • Boost Regex can fit in the bill, but I didnโ€™t spend much time figuring out if I could build it autonomously

Can anything else be?

+4
source share
5 answers

The quick google for "pcre windows" seems to say that it actually supports Windows. The .so file on my system is <200 KiB, so it doesn't seem to take up so much disk space ...

+3
source

The standard C ++ TR1 libraries contain regular expression classes. Newer versions of MSVC contain an implementation and there is Boost.Regex as an independent compiler implementation.

+3
source

My! But you have to download it as part of another tool - csvfix . The regular expression code is in the alib library, based on the code in Software Tools In Pascal, ported with a lot of changes to C ++. It is very small, about 30 thousand. Or less from the source, supports ed-style rexers, compiles on Windows and Linux, and I would like others to improve it.

+2
source

Boost.Regex will match your score in terms of compilers, although it has dependencies on other parts of the increase.

0
source

Source: https://habr.com/ru/post/1315344/


All Articles