I am porting pyspf to C (long story, and I am stupid for trying). But of course, C is not python.
So you don't have anything nearly as nice as
What is that good for, you may ask? Well, to do things like splitting email addresses while validating them, or in this specific case, to validate SPF mechanisms (nevermind what those are).
But hey, you can always do this (excuse me while I weep a little):
struct bstrList *re_split(const char *string, const char *pattern)
if (regcomp(&re, pattern, REG_ICASE|REG_EXTENDED) != 0)
return(0); /* Report error. */
char *ptr=(char *)string;
status = regexec(&re, ptr, (size_t)20, pmatch, 0);
struct bstrList *l= bsplit(tmp,0);
And that is probably wrong for some cases (and it doesn't split the exact same way as Python, but that's what unit testing is for).
I must be missing something that makes regcomp & friends nicer to use. Right? Right?