Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   pcretest    ( 1 )

программа для тестирования регулярных выражений, совместимых с Perl (a program for testing Perl-compatible regular expressions.)

Выноски (Callouts)

If the pattern contains any callout requests, pcretest's callout
       function is called during matching. This works with both matching
       functions. By default, the called function displays the callout
       number, the start and current positions in the text at the
       callout time, and the next pattern item to be tested. For
       example:

--->pqrabcdef 0 ^ ^ \d

This output indicates that callout number 0 occurred for a match attempt starting at the fourth character of the subject string, when the pointer was at the seventh character of the data, and when the next pattern item was \d. Just one circumflex is output if the start and current positions are the same.

Callouts numbered 255 are assumed to be automatic callouts, inserted as a result of the /C pattern modifier. In this case, instead of showing the callout number, the offset in the pattern, preceded by a plus, is output. For example:

re> /\d?[A-E]\*/C data> E* --->E* +0 ^ \d? +3 ^ [A-E] +8 ^^ \* +10 ^ ^ 0: E*

If a pattern contains (*MARK) items, an additional line is output whenever a change of latest mark is passed to the callout function. For example:

re> /a(*MARK:X)bc/C data> abc --->abc +0 ^ a +1 ^^ (*MARK:X) +10 ^^ b Latest Mark: X +11 ^ ^ c +12 ^ ^ 0: abc

The mark changes between matching "a" and "b", but stays the same for the rest of the match, so nothing more is output. If, as a result of backtracking, the mark reverts to being unset, the text "<unset>" is output.

The callout function in pcretest returns zero (carry on matching) by default, but you can use a \C item in a data line (as described above) to change this and other parameters of the callout.

Inserting callouts can be helpful when using pcretest to check complicated regular expressions. For further information about callouts, see the pcrecallout documentation.