Author: Philip Hazel Date: To: Eric Benzacar CC: pcre-dev Subject: Re: [pcre-dev] Is there a newsgroup for pcre?
On Thu, 14 Feb 2008, Eric Benzacar wrote:
> I'm just starting out with PCRE and running into a problem with it. I was
> wondering if there was a newsgroup where I can post my question?
Not that I know of.
> Basically, my issue is that the (?:) syntax for non-capturing groups does
> not seem to work, and was wondering if anyone else is using it successfully.
For many years!
> char *message = "This is a bug free message";
> regex_t regEx;
> int ret = regcomp( ®Ex, "(?:[aA]?[0-9]+)", REG_ICASE | REG_EXTENDED );
> char error[2048];
> regerror( ret, ®Ex, error, 2048 );
> cout << error <<endl;
> return 0;
> }
>
>
> The above mini snippet returns error code 13: repetition-operator operand
> invalid
I fairly sure you are linking your program with some other regular
expression library by accident. The message "repetition-operator operand
invalid" is not part of PCRE. If you are using a shared library under
Unix/Linux, use the ldd command to check.
Note also that the POSIX interface is much poorer than PCRE's native
interface, which has much more detailed error messages. If you are just
starting to use PCRE, I would highly recommend that you use the native
API rather than the bolted-on POSIX one. The latter was provided so that
existing programs that used the POSIX API could easily switch to PCRE.