Is it the boost library? Regex in particular? I have searched and searched, but this is all I could come up with.

If this is the correct library, then how do I get it to work in Dev-C++? I managed to add all the boost .h files to my Dev-C++ include files folder, so now it will compile when I #include a boost header file.

Does it even work in Dev-C++ though? I couldn't get it installed properly in Visual Studio. I think the path name was not quite right (to include the boost root directory).

Also, how do you use the regcomp() function? I've seen examples where it takes more than one argument, however in the regexp.h file (that came with boost) it lists only one argument. Here is the header file I am trying to use:

 * Definitions etc. for regexp(3) routines.
 * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
 * not the System V one.
#ifndef REGEXP_DWA20011023_H
# define REGEXP_DWA20011023_H

#define NSUBEXP  10
typedef struct regexp {
	char *startp[NSUBEXP];
	char *endp[NSUBEXP];
	char regstart;		/* Internal use only. */
	char reganch;		/* Internal use only. */
	char *regmust;		/* Internal use only. */
	int regmlen;		/* Internal use only. */
	char program[1];	/* Unwarranted chumminess with compiler. */
} regexp;

regexp *regcomp( char *exp );
int regexec( regexp *prog, char *string );
void regerror( char *s );

 * The first byte of the regexp internal "program" is actually this magic
 * number; the start node begins in the second byte.
#define	MAGIC	0234


And here is one example program I found online, that I can't get compiled as yet, I think because the header file they used was not boost's regexp but another regex .h file. And yes, I know it's C, but I want to do this in C++.

#include <iostream>
#include <regexp.h>//I changed the header to the one I have
#include <locale.h> 

using namespace std;

int main()
/* CELEBR07                                      

   This example compiles an extended regular expression.                        

    unsigned int MAX_MATCH = 10;
regexp re; //I changed the type here
char *pattern = ".*";                
regmatch_t pmatch[MAX_MATCH];
regcomp(&re, pattern, REG_ICASE|REG_EXTENDED|REG_NOSUB);
regexec(&re, "This is a test", MAX_MATCH, pmatch, 0);                                                                 
    char       *string = "a simple string";                                     
    char       *pattern = ".*(simple).*";                                       
    int        rc;                                                              
    if ((rc = regcomp( string))!=0 ) {                     
       printf("regcomp() failed, returning nonzero (%d)", rc);


Any hints/suggestions/shove in the right direction would be much appreciated! :)

I think you would have better luck in a forum dedicated to Boost and/or Regex questions. One thing I can suggest is that the Boost Regex has to be linked to its binaries too (boost_regex.lib or, so make sure that is set up correctly (if not you should get loads of "unresolved external reference" errors). Also, we have seen here many people with weird problems with Dev-C++, so consider either giving it another go with VS or installing Code Blocks instead.

This article has been dead for over six months. Start a new discussion instead.