Question
Using Customization Flags in RegExp
A few weeks back a couple of the experts suggested using customization flags in my regular expressions. I can manually configure my find function, but having no success using qFlags to customize my searches. Would appreciate any suggestions. Here's what I have so far:
getRegex ("[0-9][0-9][0-9] [A-Z]", "Green", 0, 1, 0, 1)
// bRegEx = 0, bCase = 1, bWord = 0, and bWild = 1
function getRegex (regex, color, bRegEx, bCase, bWord, bWild) {
doc=app.ActiveDoc;
docStart = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
tloc = new TextLoc (docStart, 0);
findParams = new PropVals ();
propVal = new PropVal ();
propVal.propIdent.num = Constants.FS_FindText;
propVal.propVal.valType = Constants.FT_String;
propVal.propVal.sval = regex; // searchstring variable
findParams[0] = propVal;
if (bWord || bCase || bBack || bRegEx || bWild) {
propVal = new PropVal ();
propVal.propIdent.num = Constants.FS_FindCustomizationFlags;
propVal.propVal.valType = Constants.FT_Integer;
propVal.propVal.ival = 1
qFlags = 0;
if (bCase) { propVal.propVal.ival | Constants.FF_FIND_CONSIDER_CASE;} // 0x01
if (bRegEx) { propVal.propVal.ival | Constants.FF_FIND_USE_REGEX; // 0x10
propVal = new PropVal ();
propVal.propIdent.num = Constants.FS_RegexFlavour;
propVal.propVal.valType = Constants.FT_Integer;
propVal.propVal.ival = Constants.FR_USE_PERL;
findParams[2] = propVal;
} else {
if (bWild) { propVal.propVal.ival|Constants.FF_FIND_USE_WILDCARDS;} // 0x04
if (bWord) { propVal.propVal.ival|Constants.FF_FIND_WHOLE_WORD;} // 0x02
}
findParams[1] = propVal;
}
propVal = new PropVal ();
propVal.propIdent.num = Constants.FS_FindWrap;
propVal.propVal.valType = Constants.FT_Integer;
propVal.propVal.ival=0;
findParams[3] = propVal;
foundText = doc.Find(tloc, findParams);
while (foundText.beg.obj.ObjectValid() && FA_errno == Constants.FE_Success) {
