| View previous topic :: View next topic |
| Author |
Message |
Lorenzo Bettini Guest
|
Posted: Mon Aug 16, 2004 7:47 pm Post subject: Regular Expressions in C++ |
|
|
Hi
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
thanks in advance
cheers
Lorenzo
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Thomas Maeder Guest
|
Posted: Tue Aug 17, 2004 9:42 am Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini <bettini (AT) dsi (DOT) unifi.it> writes:
| Quote: | do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Cf. http://www.boost.org/
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ivan Vecerina Guest
|
|
| Back to top |
|
 |
David B. Held Guest
|
Posted: Tue Aug 17, 2004 9:58 am Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini wrote:
| Quote: | do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Boost.Regex? You ought to take a look at all of Boost, really.
Dave
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Terje Slettebų Guest
|
Posted: Tue Aug 17, 2004 9:59 am Post subject: Re: Regular Expressions in C++ |
|
|
"Lorenzo Bettini" <bettini (AT) dsi (DOT) unifi.it> wrote
| Quote: |
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Have a look at:
- Boost.Regex ([url]http://www.boost.org/libs/regex/doc/index.html)[/url],
- GRETA (http://research.microsoft.com/projects/greta/) or
- Xpressive
([url]http://cvs.sourceforge.net/viewcvs.py/*checkout*/boost-sandbox/boost-sandbo[/url]
x/libs/xpressive/index.html) (in the Boost Sandbox) - GRETA's "successor".
Regards,
Terje
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Lucius Guest
|
Posted: Tue Aug 17, 2004 6:59 pm Post subject: Re: Regular Expressions in C++ |
|
|
"Lorenzo Bettini" <bettini (AT) dsi (DOT) unifi.it> ha scritto nel messaggio
news:cfqdgr$eej$1 (AT) newsfeed (DOT) cineca.it...
| Quote: | Hi
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Look at
www.boost.org
Ciao,
Enrico
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Eric Niebler Guest
|
Posted: Tue Aug 17, 2004 7:00 pm Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini wrote:
| Quote: | Hi
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Certainly. Check out these:
Boost.Regex
http://boost.org/libs/regex
Widely used, well tested, efficient, good STL integration. Forms the
basis for the current proposal to add regular expressions to the
Standard Library. Totally free.
GRETA
http://research.microsoft.com/projects/greta
Fast, highly perl compliant, good STL integration. Free for commercial
use (if you get it via the PowerTools download at
http://www.gotdotnet.com/team/cplusplus/)
PCRE (Perl Compatible Regular Expressions)
http://www.pcre.org/
Excellent perl compliance. No STL integration. Free for commercial use.
And if you're feeling adventurous...
xpressive
Available via CVS in the boost-sandbox
(http://sourceforge.net/projects/boost-sandbox/)
Similar to Boost.Regex, except that regular expressions can be written
either as strings or as expression templates (for improved performance
and syntax-checking at compile time). Currently in beta. Totally free.
(Full disclosure: I wrote GRETA and am actively developing xpressive.)
--
Eric Niebler
Boost Consulting
www.boost-consulting.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Maxim Yegorushkin Guest
|
Posted: Tue Aug 17, 2004 7:01 pm Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini <bettini (AT) dsi (DOT) unifi.it> wrote:
| Quote: | do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
|
Under Linux you may use regex library (see man regex). If you need a crossplatform solution you may want to use boost::regex library. (it's funny, I've seen acknowledgment in Max Payne 2 that they used boost::regex).
--
Maxim Yegorushkin
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
John Sheehan Guest
|
Posted: Tue Aug 17, 2004 7:02 pm Post subject: Re: Regular Expressions in C++ |
|
|
Use boost::regex. It is an excellent implementation.
John
Lorenzo Bettini <bettini (AT) dsi (DOT) unifi.it> wrote
| Quote: | Hi
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
thanks in advance
cheers
Lorenzo
|
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
John Buck Guest
|
Posted: Tue Aug 17, 2004 7:51 pm Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini <bettini (AT) dsi (DOT) unifi.it> wrote
| Quote: | Hi
do you have any suggestions about what library to use for dealing with
regular expressions in your C++ programs? I need a free/GPL stuff.
thanks in advance
cheers
Lorenzo
|
Boost has an excellent Regular expression library that works on a
variety of platforms. www.boost.org
--
JB
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Lorenzo Bettini Guest
|
Posted: Fri Aug 20, 2004 1:01 am Post subject: Re: Regular Expressions in C++ |
|
|
Maxim Yegorushkin wrote:
| Quote: | Lorenzo Bettini <bettini (AT) dsi (DOT) unifi.it> wrote:
do you have any suggestions about what library to use for dealing
with regular expressions in your C++ programs? I need a free/GPL
stuff.
Under Linux you may use regex library (see man regex). If you need a
crossplatform solution you may want to use boost::regex library.
(it's funny, I've seen acknowledgment in Max Payne 2 that they used
boost::regex).
|
thanks to everyone for all the links!
It looks like boost::regex is one of your favourites
I'll also give a look at GNU regex (the last release is date 1993!)
actually I need a library to implement a sort of scanner on the fly,
i.e., read a configuration file and scan a file according to regular
expressions specified in the configuration file. Do you think using a
regular expression library is the right solution?
thanks in advance again for any suggestions
Lorenzo
--
+-----------------------------------------------------+
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
David B. Held Guest
|
Posted: Fri Aug 20, 2004 10:08 am Post subject: Re: Regular Expressions in C++ |
|
|
Lorenzo Bettini wrote:
| Quote: | [...]
actually I need a library to implement a sort of scanner on the fly,
i.e., read a configuration file and scan a file according to regular
expressions specified in the configuration file. Do you think using a
regular expression library is the right solution?
|
You definitely need to look at Spirit: spirit.sourceforge.net.
Dave
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Lorenzo Bettini Guest
|
Posted: Sat Aug 21, 2004 3:30 am Post subject: Re: Regular Expressions in C++ |
|
|
David B. Held wrote:
| Quote: | Lorenzo Bettini wrote:
[...]
actually I need a library to implement a sort of scanner on the fly,
i.e., read a configuration file and scan a file according to regular
expressions specified in the configuration file. Do you think using a
regular expression library is the right solution?
You definitely need to look at Spirit: spirit.sourceforge.net.
|
interesting tool!
but probably that's even too much for what I need to do.
I'm the maintainer of GNU source-highlight,
http://www.gnu.org/software/src-highlite, that only performs lexical
analysis and not parsing. So I need to manipulate regular expressions,
more than grammars. At the moment, if you want to add a new language to
source-highlight you have to write a flex scanner... now I'd like to
provide an easier syntax to define a new language (tokens, operators and
so on) and let source-highlight use regular expressions according to the
tokens specified.
Lorenzo
--
+-----------------------------------------------------+
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|