lStrWildCmpEx() new flags

ot4xb version 1.6.4.81 introducing the new function lStrWildCmpEx() that is an extension of the existing lStrWildCmp()

As the lStrWildCmp() old function the new lStrWildCmpEx() function compare an input string with a template string that can contain wildcards * and ? like the directory wildcards.

The previous function was only supporting the flag 1 or .T. meaning case insensitive compare

lStrWildCmpEx() with the flag 0x200 support C++ 14 stdlib regular expressions ( faster  than the ot4xb rgx class or functions based on the VB Script reg exp)

Another new feature is that we can provide also an array of wildcard strings instead of a single wildcard string


Syntax


lStrWildCmpEx( cWild|aWild , cStr,[nFlags],[regex_flags],[regex_match_flags]) -> lMatch

cWild|aWild
....
cStr
....
nFlags
Can be a combination of zero or more of the following flags
 0x0001 = case insensitive
 0x0002 = return found index ( first or last if flags & 4 )
 0x0004 = stop at last ocurrence
 0x0008 = add * at the begining and end of the wildcard emulating the $ operator (1.6.4.84)
 0x0010 = compare left trimmed string if not using regexp
 0x0020 = compare right trimmed string if not using regexp
 0x0040 = allow ^ at the begining as negation ( 1.6.4.85)
 0x0200 = ot4xb_regex_match
 0x8000 = ( only arrays without regexp) ( 1.6.4.85)
                 if ~ ( char 126) at the begining the expression MUST NOT exist
                 if ` ( char 96) at the begining the expression MUST exist
0x0100 = use template characters ( alphanumeric(A) ,numbers (9)  and symbols )

regex_flags
Only with nFlags & 0x200
ECMAScript = 0x01   ( DEFAULT )
basic = 0x02
extended = 0x04
awk = 0x08
grep = 0x10
egrep = 0x20
_Gmask = 0x3F
icase = 0x0100
nosubs = 0x0200
optimize = 0x0400
collate = 0x0800

regex_match_flags
Only with nFlags & 0x200
match_default = 0x0000,
match_not_bol = 0x0001,
match_not_eol = 0x0002,
match_not_bow = 0x0004,
match_not_eow = 0x0008,
match_any = 0x0010,
match_not_null = 0x0020,
match_continuous = 0x0040,
match_prev_avail = 0x0100,
format_default = 0x0000,
format_sed = 0x0400,
format_no_copy = 0x0800,
format_first_only = 0x1000

1 comment:

  1. New Flags introduced on v 1.6.4.82
    0x10 = compare left trimmed string if not using regexp
    0x20 = compare right trimmed string if not using regexp

    ReplyDelete