Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Regular Expression in C++

Hi Friends,

I wanted to know whether there is any kind of support i.e, BuiltIn libraries in C++ to implement the regular expressions. The library should work on all types (Linux Based) Operating systems. I am working on Fedora Core 5 at present .

I am writing my own code in C++ for Regular Expressions right now but that is very length process and is consuming a lot of time.

Please help me in finding a Better Solution to this Problem

Thanks in Advance
Praveen :)
[505 byte] By [praveenholal] at [2007-11-11 10:28:40]
# 1 Re: Regular Expression in C++
try boost.org, there are definately several regex parsers out there.
jonnin at 2007-11-11 20:58:48 >
# 2 Re: Regular Expression in C++
Thank you for ur suggestion , but i think boost is a operating system dependent library . I need to write a program that runson all OS (linux) .

So do u have any idea about other libraries or links of particular resource on c++ regular expressions.
praveenholal at 2007-11-11 20:59:45 >
# 3 Re: Regular Expression in C++
Thank you for ur suggestion , but i think boost is a operating system dependent library . I need to write a program that runson all OS (linux) .

So do u have any idea about other libraries or links of particular resource on c++ regular expressions.

did you REALLY look into boost? :confused:
I'm using boost on Win, AIX, Linux...
rssmps at 2007-11-11 21:00:44 >
# 4 Re: Regular Expression in C++
did you REALLY look into boost? :confused:
I'm using boost on Win, AIX, Linux...

Thank you very much . I just asked that question because i am new to boost library and have not worked on it.
Please also specify how to install the boost library ( I am using fedora core 5 ) and using g++ compiler. Although i went through installation notes i didnt get it.

If you tell it in common language i may understand the installation process.

Thanks in Advance
Praveen :)
praveenholal at 2007-11-11 21:01:47 >
# 5 Re: Regular Expression in C++
installation issues might be better addressed in the boost mailing list. You might also want to search thru the old mailing list archive to see if a solution has been posted for similar situations.

The instructions are pretty clear on the boost website. How about you list out the steps you've taken so far and we can try to pin point where you're missing things.
rssmps at 2007-11-11 21:02:47 >
# 6 Re: Regular Expression in C++
First i thank you for your reply. At present i am installing the boost library and i have downloaded the boost-jam-3.1.13-1.i386.rpm and now i have installed the package. Now i need to go ahead and try other things.

Then i will post the steps i have taken to install and please rectify me if i have done mistakes somewhere during installation.

Praveen :)
praveenholal at 2007-11-11 21:03:52 >
# 7 Re: Regular Expression in C++
Steps followed to install Boost Libraries

Downloaded Boost C++ Libraries From
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041

downloaded boost-jam-3.1.13-1.i386.rpm

installed RPM using rpm -ivh boost-jam-3.1.13-1.i386.rpm

After installing i found the following things related to boost library installed on my machine.

Header files are installed in
/usr/include/boost/
/usr/include/c++/

Library files are installed in
/usr/lib/

Some other files are installed in
/usr/share/doc/

Then i gave the command bjam ="-sTOOLS=gcc" install

The following Error Message is displayed

Unable to load Boost.Build: could not find "boost-build.jam"
-------------------
Attempted search from /usr/include/boost up to the root
and in these directories from BOOST_BUILD_PATH and BOOST_ROOT: /usr/share/boost-build.

Please Guide me...

Thanks in Advance
Praveen :)
praveenholal at 2007-11-11 21:04:51 >
# 8 Re: Regular Expression in C++
Hi friends ,

I am very happy to say that i got the boost library installed on my machine and it is up . I wrote some programs and tested . I am really very happy.

I specially thank rssmps and jonnin who gave me reply .

Another Small help i am asking rssmps is , please pass on some programs that you have written in c++ using boost , particularly for implementing Regular Expressions.

Thanks a Lot.....
Praveen
praveenholal at 2007-11-11 21:05:56 >
# 9 Re: Regular Expression in C++
Anyway, you would probably be glad to hear that ISO C++ has a regex library based on Boost's. If you can download the latest Standard Library headers and CRTs, you will be able to use std::tr1::regex... components. Dinkumware offer this new version of the Standard Library.
Danny at 2007-11-11 21:06:59 >
# 10 Re: Regular Expression in C++
Another Small help i am asking rssmps is , please pass on some programs that you have written in c++ using boost , particularly for implementing Regular Expressions.

I don't have anything using regex...I've only used the connected_components stuff for graphs.

http://www.boost.org/libs/graph/example/connected_components.cpp
rssmps at 2007-11-11 21:07:56 >
# 11 Re: Regular Expression in C++
Anyway, you would probably be glad to hear that ISO C++ has a regex library based on Boost's. If you can download the latest Standard Library headers and CRTs, you will be able to use std::tr1::regex... components. Dinkumware offer this new version of the Standard Library.

Thanks Danny. But i visited Dinkumware website , but they are charging for libraries , ithink its not freely downloadable. If you knnow other resources please let me know.

I searched in google for code examples on boost library but didnt get the correct examples that i was looking for . Can you all help me in finding some good resource for boost , either a tuorial or links to them...

Thanks in Advance
Praveen
praveenholal at 2007-11-11 21:08:59 >