Short patterns system, short pattern check
(superstructure over LUA-regex)


The system of short templates represents parser, automatically reformative asked template in LUA-Regex. It is created for simplification of templates addition. The usual text will automatically transformed symbol-by-symbol to templates of the different register and similar symbols which can be present some times. Also there are special symbols:

Symbol "*" in the beginning and (or) in the end of template means that here the line begins (or comes to an end) or there is one of space symbols (it is convenient to designate entirely phrase or word which can make all message or to be in it and separated space symbols). This variant will return at once all variants of the templates, satisfying to this condition.

Symbol "-" means that the symbol before it can be only once (the template from one or more symbols is by default formed).

Symbol "?" means that the symbol before it can be present 0 or more times.

Symbols "[ and ]" means that in the given place there can be one of the symbols specified between them.

Symbols "( and )" define capture in an initial line of the site located between them. All captures are accessible on inclusions from %1 to %9 in answer. The template with reserved first and last capture is by default formed, therefore it should be considered.

Symbol "_" means that in this place there is one of space symbols.

Symbol "%" it is used for transfer symbol to template "as is", without change by short pattern engine. To program directly symbol % use a template "%%%%", it will mean LUA-template "%%".

Symbols ^ and $ in the beginning and the template end mean the beginning and the end of an initial line accordingly.

More in detail about LUA templates read in the instruction by LUA or in the instruction by anti-advertising plugin.

Consider that symbols ^$()%.[]*+-? are office and should be shielded by symbol "%", that for short template will look as "%%", and to program, for example, an office symbol "+" a part of an initial line, you should write short template "%%%+", that will be transformed to LUA-template as "%+".

For example:
  By template "test" will return short pattern "(%z?)[Tt]+[Ee]+[Ss]+[Tt]+(%z?)". If wish to set template on a word "one" but so that it meant only a word entirely and did not react, for example, to a phrase "loner" or "Onegin" take short template in symbols "star". Thus, on short template "*one*" will return LUA-regexes:
([%s%p])[Oo]+[Nn]+[Ee]+([%s%p])
^(%z?)[Oo]+[Nn]+[Ee]+([%s%p])
([%s%p])[Oo]+[Nn]+[Ee]+(%z?)$
^(%z?)[Oo]+[Nn]+[Ee]+(%z?)$

And if wish to program, for example, command "!test test" or "+test test", command and through blank any word can take advantage of short template "^[%%%+!]test_test", on what will returned template "^(%z?)[%+!]+[Tt]+[Ee]+[Ss]+[Tt]+[%s]+[Tt]+[Ee]+[Ss]+[Tt]+".

For check the short template to look, as the desirable short template and what template LUA will be processed will be returned, use service short pattern check (in triggers plugin). For this use command !checkpattern <short pattern>.


<<< back | print | To main...
PhazaSoft© Ekzekutor©
Hosted by uCoz