Skip to content

Instantly share code, notes, and snippets.

@ryanjdew
Created May 25, 2014 12:39
Show Gist options
  • Save ryanjdew/381af8580143f4c58f6d to your computer and use it in GitHub Desktop.
Save ryanjdew/381af8580143f4c58f6d to your computer and use it in GitHub Desktop.
C++ start MarkLogic UDF function
void BucketeerRegex::
start(Sequence& arg, Reporter& reporter)
{
overflow_bucket = "bucketeer:overflow";
case_insensitive = false;
capture_overflow = false;
int reti;
int case_sensitive = 0;
int extended = 0;
arg.value(regex);
arg.next();
while(!arg.done()) {
String arg_value;
arg.value(arg_value);
const char* val = arg_value.get();
if (strcmp(val,"case-insensitive") == 0) {
case_sensitive = REG_ICASE;
case_insensitive = true;
} else if (strcmp(val,"extended") == 0) {
extended = REG_EXTENDED;
} else if (strcmp(val,"capture-overflow") == 0) {
capture_overflow = true;
}
arg.next();
}
/* Compile regular expression */
reti = regcomp(&regex_compiled, regex.get(), case_sensitive|extended);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment