Example use "ip" to replce (| 0x10000 1), {u} than 2048
Code: Select all
CELL* parseRegexOptions(CELL* params, UINT * options, int evalFlag)
{
CELL* cell;
int i;
char* buffer;
if (evalFlag)
cell = evaluateExpression(params);
else
cell = params;
*options = 0;
if (cell->type == CELL_STRING) {
buffer = (char*)cell->contents;
for (i = 0; i < cell->aux; i ++) {
switch (buffer[i]) {
case 'i': *options |= 1; break; /* PCRE_CASELESS */
case 'm': *options |= 2; break; /* PCRE_MULTILINE */
case 's': *options |= 4; break; /* PCRE_DOTALL */
case 'x': *options |= 8; break; /* PCRE_EXTENDED */
case 'u': *options |= 2048; break; /* PCRE_UTF8 */
case 'p': *options |= 0x10000; break; /* PRECOMPILED */
}
}
} else {
getIntegerExt(cell, options, FALSE);
}
return (params->next);
}
For parse regex replace directory member find-all starts-with ends-with just change getInteger(..., &options) / getIntegerExt(..., &options, FALSE) to parseRegexOptions
search and find check options's type, we need one more step. Change
isNumber(params->type)
to
(isNumber(params->type) || params->type == CELL_STRING)
At last find has two syntax so two place to change.
It's useful for people come from PCRE world. And someone asked this feature months ago.