You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdelibs/tdecore/README.tdestringmatcher

64 lines
2.8 KiB
Plaintext

The TDEStringMatcher class provides string matching against a list of
one or more TQRegExp objects. The matching functions currently provided
are:
matchAny(): strings match if they match any TQRegExp object in list.
matchAll(): strings match only if the match all TQRegExp objects in list.
The list of TQRegExp objects is constructed using a specially formatted string
that is passed by applications via the generatePatternList() function. This
string is referred to as the "patternString" and is formatted as follows:
* The first character of the patternString defines the character that
is used to split the remainder of the string into match specification
strings. It is recommended (but not required) that this be a character
that does not occur in a match pattern (see below).
* Each match specification string consists of an initial character that
designates the match specification type followed by the corresponding
match specification itself.
* Match specification strings starting with 'o' are followed by zero or
or more letters, each of which are interpreted as setting or unsetting
a match option. Match options remain in effect until explicitly overridden
by subsequent match options. The match option letters that are currently
recognized and processed are:
'w' - Match patterns are to be interpreted as "wildcards"
'r' - Match patterns are to be interpreted as "regexes" (TQRegExp default)
'c' - Matching will be case-sensitive (TQRegExp default)
'c' - Matching will be case-INsensitive
'm' - Regex matching will be "minimal" versus "greedy"
'g' - Regex matching will be "greedy" (TQRegExp default)
* Match specification strings starting with 'p' are followed by one or
more characters that constitute a match pattern. Each match pattern
together with the match options in effect are used to construct
a single TQRegExp object to be used for string matching. This object
will be validated before acceptance.
* Match specification strings starting with any other character are ignored.
Some examples of patternString:
* |ow|p.*|p*~
Dotfiles and kwrite backup files will be matched via wildcards
* /or/p[.][0-9]+$/ow/p.*
Files with a version number suffix will be matched via regex
and dotfiles will be matched via wildcard
Current and potential use of the TDEStringMatcher class include:
* Expansion of definition of "hidden" files, addressing issue # 270.
* Creation of a subclass that provides string parsing functions.
Miscellaneous implementation notes:
* It is the responsibility of applications that use this class to provide
patternString editing (perhaps via UI), storage, and retrieval.
* Regex patterns use TQRegExp::search for matching but wildcard patterns
must use TQRegExp::exactMatch in order for matching to work correctly.