New INSTR Flags

Two new flags implmeneted in INSTR:

Flag

Value

Description

INSTRF_ANY

&h01000000

Treat pattern as set of characters; match first one that appears in subject.

INSTRF_ANYQT

&h02000000

Same as INSTRF_ANY but ignores characters in subject between matching quotes.

 

Note that unlike all of the other INSTR() flags, these do not actually use the REGEX library. They are instead based on the standard C function strpbrk(). For example:

PRINT INSTR(1, "DSK0:ABC.RUN /X", ";/ ", INSTRF_ANY)

Of the three characters in the pattern (";/ "), the first to occur in the subject is the space at position 13.

The above is equivalent to the REGEX character set pattern "[;/ ]"; it simply eliminates any doubts about REGEX syntax for special characters. But the INSTRF_ANYQT version is much harder to implement using REGEX.