C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regular Expressions in C++

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Lorenzo Bettini
Guest





PostPosted: Mon Aug 16, 2004 7:47 pm    Post subject: Regular Expressions in C++ Reply with 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
Thomas Maeder
Guest





PostPosted: Tue Aug 17, 2004 9:42 am    Post subject: Re: Regular Expressions in C++ Reply with quote



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





PostPosted: Tue Aug 17, 2004 9:57 am    Post subject: Re: Regular Expressions in C++ Reply with quote



"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.

The two main options that come to mind are:
boost::regex:
http://www.boost.org/libs/regex/doc/index.html
pcre:
http://www.pcre.org/

Libraries such as Qt or (the dev version of) wxWindows also include
a regular expressions engine.
Note also the not totally free:
http://research.microsoft.com/projects/greta/


I hope this helps,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form



[ 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





PostPosted: Tue Aug 17, 2004 9:58 am    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Tue Aug 17, 2004 9:59 am    Post subject: Re: Regular Expressions in C++ Reply with quote

"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





PostPosted: Tue Aug 17, 2004 6:59 pm    Post subject: Re: Regular Expressions in C++ Reply with quote

"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





PostPosted: Tue Aug 17, 2004 7:00 pm    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Tue Aug 17, 2004 7:01 pm    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Tue Aug 17, 2004 7:02 pm    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Tue Aug 17, 2004 7:51 pm    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Fri Aug 20, 2004 1:01 am    Post subject: Re: Regular Expressions in C++ Reply with quote

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 Smile
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


--
+-----------------------------------------------------+
Quote:
Lorenzo Bettini ICQ# lbetto, 16080134 |
PhD in Computer Science |
Dip. Sistemi e Informatica, Univ. di Firenze |
Florence - Italy (GNU/Linux User # 158233) |
Home Page : http://www.lorenzobettini.it |
http://music.dsi.unifi.it XKlaim language |
http://www.lorenzobettini.it/purple Cover Band |
http://www.gnu.org/software/src-highlite |
http://www.gnu.org/software/gengetopt |
http://www.lorenzobettini.it/software/gengen |
http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+


[ 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





PostPosted: Fri Aug 20, 2004 10:08 am    Post subject: Re: Regular Expressions in C++ Reply with quote

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





PostPosted: Sat Aug 21, 2004 3:30 am    Post subject: Re: Regular Expressions in C++ Reply with quote

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

--
+-----------------------------------------------------+
Quote:
Lorenzo Bettini ICQ# lbetto, 16080134 |
PhD in Computer Science |
Dip. Sistemi e Informatica, Univ. di Firenze |
Florence - Italy (GNU/Linux User # 158233) |
Home Page : http://www.lorenzobettini.it |
http://music.dsi.unifi.it XKlaim language |
http://www.lorenzobettini.it/purple Cover Band |
http://www.gnu.org/software/src-highlite |
http://www.gnu.org/software/gengetopt |
http://www.lorenzobettini.it/software/gengen |
http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.