Blame doc/perltest.txt

Packit 78a954
The perltest program
Packit 78a954
--------------------
Packit 78a954
Packit 78a954
The perltest.pl script tests Perl's regular expressions; it has the same
Packit 78a954
specification as pcretest, and so can be given identical input, except that
Packit 78a954
input patterns can be followed only by Perl's lower case modifiers and certain
Packit 78a954
other pcretest modifiers that are either handled or ignored:
Packit 78a954
Packit 78a954
  /+   recognized and handled by perltest
Packit 78a954
  /++  the second + is ignored
Packit 78a954
  /8   recognized and handled by perltest
Packit 78a954
  /J   ignored
Packit 78a954
  /K   ignored
Packit 78a954
  /W   ignored
Packit 78a954
  /S   ignored
Packit 78a954
  /SS  ignored
Packit 78a954
  /Y   ignored
Packit 78a954
Packit 78a954
The pcretest \Y escape in data lines is removed before matching. The data lines
Packit 78a954
are processed as Perl double-quoted strings, so if they contain " $ or @
Packit 78a954
characters, these have to be escaped. For this reason, all such characters in
Packit 78a954
the Perl-compatible testinput1 file are escaped so that they can be used for
Packit 78a954
perltest as well as for pcretest. The special upper case pattern modifiers such
Packit 78a954
as /A that pcretest recognizes, and its special data line escapes, are not used
Packit 78a954
in the Perl-compatible test file. The output should be identical, apart from
Packit 78a954
the initial identifying banner.
Packit 78a954
Packit 78a954
The perltest.pl script can also test UTF-8 features. It recognizes the special
Packit 78a954
modifier /8 that pcretest uses to invoke UTF-8 functionality. The testinput4
Packit 78a954
and testinput6 files can be fed to perltest to run compatible UTF-8 tests.
Packit 78a954
However, it is necessary to add "use utf8; require Encode" to the script to
Packit 78a954
make this work correctly. I have not managed to find a way to handle this
Packit 78a954
automatically.
Packit 78a954
Packit 78a954
The other testinput files are not suitable for feeding to perltest.pl, since
Packit 78a954
they make use of the special upper case modifiers and escapes that pcretest
Packit 78a954
uses to test certain features of PCRE. Some of these files also contain
Packit 78a954
malformed regular expressions, in order to check that PCRE diagnoses them
Packit 78a954
correctly.
Packit 78a954
Packit 78a954
Philip Hazel
Packit 78a954
January 2012