[Lazarus] TMask revisited

José Mejuto joshyfun at gmail.com
Tue Oct 19 10:43:43 CEST 2021


El 18/10/2021 a las 22:39, Bart via lazarus escribió:

>> Most people are familiar with ranges "[a-z]", optional chars use the
>> same "[" syntax but without the dash "-", so "[abcde]" matches one
>> position with any of those chars or if you negate the set "[!abcde]" it
>> will match any char *except* any of those.
> 
> So, with that option specified ranges work like "sets" in the old
> Masks implementation?
> And [a-z] will mean either 'a' or '-' or 'z'?
> 

Hello,

Yes, at least it should. To completely disable the "[" syntax three 
options must be removed from default, "eMaskOpcodeOptionalChar", 
"eMaskOpcodeRange" and "eMaskOpcodeAnyCharOrNone".

eMaskOpcodeAnyCharOrNone = [???] matches 0, 1, 2 or 3 chars.
eMaskOpcodeRange = [a-z] matches 1 char from "a" to "z".
eMaskOpcodeOptionalChar = [abc] matches "a" or "b" or "c"

With the three options disabled "[" is interpreted as a regular 
character to be matched.

With "eMaskOpcodeRange" and "eMaskOpcodeOptionalChar" enabled to match 
"a" or "-" or "z" the "-" must be escaped (something like regex) using 
the escapechar, by default "\", in this way "[a\-z]".

-- 



More information about the lazarus mailing list