Mail Archives: djgpp/1997/09/10/04:59:07
On Fri, 5 Sep 1997, Michael Mauch wrote:
> I tried to use the functions regcomp() and regexec() from DJGPP's
> regex.h, but obviously I'm plain too dumb to get these things to
> work.
Not dumb, just plain tired (judging by the hour you've written your
message).
> I include my test program below. It always prints "Matching", even if I
> match the RE "a" against the string "b".
Here's the line that gives you the trouble:
> r = regexec(®ex,strRegex,1,pMatch,eFlags | REG_TRACE);
^^^^^^^^
You should have passed strString, not strRegex, to `regexec'!
Otherwise, you are matching the pattern against itself, which will
almost always succeed (at least for simple patterns).
> BTW: Searching for an example program using "regex.h", I found the file
> DJGPP\TESTS\LIBC\POSIX\REGEX\r1.c which seems to be rather
> incomplete/broken - is this only on my machine or is there another
> secret behind it?
Yes, r1.c seems to be corrupted. Please report this to DJ Delorie
<dj AT delorie DOT com>.
- Raw text -