目前我在写一个字符串模式匹配控件,还没有写完,在编写调试中,头都写大了,当前实现了:
* Patterns can contain several special character for wild-card matching:
* match any number of characters or white space
? match a single character
%d match any number of digits (0-9)
%n match a number that starts with a + or - sign - 没有实现
%w match any number of alpha characters (a-z) (a word)
%a match any number of alphanumeric characters (a-z,0-9)
%s match any amount of white space (spaces, tabs)
%x match any amount of non-white space
%yc catch chars until find Special char: 'c'(c would not include).(匹配直到发现指定的字符:c, 支持中文字符)
[range] match any amount of characters listed in range (不支持中文字符)
^ force pattern to match starting at the beginning of the line
$ force pattern to match ending at the end of the line
(pattern) save the matched pattern in a parameter * ~ quote the next character to prevent it to be interpreted as a wild card.
~~ match a quote character verbatim
{val1 and val2 and val3 and ...} match any of the specified strings - 没有实现
{^string} do not match the specified string - 没有实现
&nn matches exactly nn characters (fixed width pattern) - 没有实现
&VarName assignes the matched string to the given variable - 没有实现
To save any part of the pattern to the parameters, enclose the part of the
parameter in parenthesis.
In specifying a range, you can list specific characters such as [abc] or you can use
a range [a-c]. To use a wild card character in the string itself, preceed the special
character with the ~ quote character. For example, the pattern ~[test~] will match the
string [test] rather than being interpreted as a range wild-card pattern.
Note that the quote character can be changed in the Preferences section.
To match a blank line, use the $ pattern by itself.
To match multiple lines include $ in the middle of the pattern to match the line boundry.
You can also include variables in your pattern, and the name of the variable will be replaced
with its value before the pattern match is performed.