Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   C++ cross-platform Regular Expression Library (http://www.programmingforums.org/showthread.php?t=15458)

Soulstorm Mar 22nd, 2008 6:23 PM

C++ cross-platform Regular Expression Library
 
I am building something that seems to be an IRC chat client... :)

I have managed to do all connections and send and receive text from the server. However, the difficult part is to actually process the received messages.

I figured out I need regular expressions for this, only I don't know how to implement them! Installing Boost (which has regular expressions) is a pain in the butt for OS X, so can anyone provide me with a cross-platform regular expression Library?

I am using OS X, so Windows specific answers will not help.

Ancient Dragon Mar 22nd, 2008 8:29 PM

Re: C++ cross-platform Regular Expression Library
 
use boost Regular Expressions, but I don't know if it supports your os or not. Probably does because it can be compiled for both *nix and MS-Windows. Read all about boost libraries here.

The Dark Mar 22nd, 2008 9:17 PM

Re: C++ cross-platform Regular Expression Library
 
I can recommend PCRE.

Ooble Mar 23rd, 2008 3:19 AM

Re: C++ cross-platform Regular Expression Library
 
Installing Boost is easy with MacPorts.

Soulstorm Mar 23rd, 2008 7:10 AM

Re: C++ cross-platform Regular Expression Library
 
I don't want to use boost. It is a pain in the butt to install. And Ooble's recommendation was nice, but it didn't work for me, because for some reason, because the script fails to install the .profile file inside my user directory. So, I can't install anything.

Quote:

Originally Posted by The Dark (Post 142775)
I can recommend PCRE.

Thanks! At least that was installed. How can I find a tutorial or any documentation on how to use this library with C++? What headers do I need to include?

The Dark Mar 23rd, 2008 7:29 AM

Re: C++ cross-platform Regular Expression Library
 
Have a look at the pcrecpp.h file - it should be in the pcre directory. It is a wrapper for use with c++. This makes it a lot easier to use the library. There is a lot of instructions and examples in the .h file.

Soulstorm Mar 23rd, 2008 10:16 AM

Re: C++ cross-platform Regular Expression Library
 
Quote:

Originally Posted by The Dark (Post 142799)
Have a look at the pcrecpp.h file - it should be in the pcre directory. It is a wrapper for use with c++. This makes it a lot easier to use the library. There is a lot of instructions and examples in the .h file.

I am using OS X. Could you be more specific? If you are using windows, where do you find those files on windows? It may help me with this...

The Dark Mar 23rd, 2008 10:49 AM

Re: C++ cross-platform Regular Expression Library
 
They were in the base of the library. Probably the best thing to do would be to download the zip file from the site and use the source code that comes with it. It should compile OK on OS X (I think a friend of mine has tried it).

Soulstorm Mar 27th, 2008 3:53 AM

Re: C++ cross-platform Regular Expression Library
 
What do you mean by that? To just throw the folder into my project and just type "include "pcre.h""?

Actually, I am trying to do this, but it always complain about files it can't find!

Ooble Mar 27th, 2008 7:56 AM

Re: C++ cross-platform Regular Expression Library
 
What complaints do you get? Are they compiler errors or linker errors?


All times are GMT -5. The time now is 9:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC