Documentation improvement.

This commit is contained in:
Philip.Hazel 2015-11-14 17:08:03 +00:00
parent 7a233130ad
commit 7c429c593c
1 changed files with 18 additions and 15 deletions

View File

@ -1,4 +1,4 @@
.TH PCRE2TEST 1 "05 November 2015" "PCRE 10.21"
.TH PCRE2TEST 1 "14 November 2015" "PCRE 10.21"
.SH NAME
pcre2test - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@ -1091,13 +1091,16 @@ by name.
.rs
.sp
If the \fBreplace\fP modifier is set, the \fBpcre2_substitute()\fP function is
called instead of one of the matching functions. Unlike subject strings,
\fBpcre2test\fP does not process replacement strings for escape sequences. In
UTF mode, a replacement string is checked to see if it is a valid UTF-8 string.
If so, it is correctly converted to a UTF string of the appropriate code unit
width. If it is not a valid UTF-8 string, the individual code units are copied
directly. This provides a means of passing an invalid UTF-8 string for testing
purposes.
called instead of one of the matching functions. Note that replacement strings
cannot contain commas, because a comma signifies the end of a modifier. This is
not thought to be an issue in a test program.
.P
Unlike subject strings, \fBpcre2test\fP does not process replacement strings
for escape sequences. In UTF mode, a replacement string is checked to see if it
is a valid UTF-8 string. If so, it is correctly converted to a UTF string of
the appropriate code unit width. If it is not a valid UTF-8 string, the
individual code units are copied directly. This provides a means of passing an
invalid UTF-8 string for testing purposes.
.P
If the \fBglobal\fP modifier is set, PCRE2_SUBSTITUTE_GLOBAL is passed to
\fBpcre2_substitute()\fP. After a successful substitution, the modified string
@ -1110,12 +1113,12 @@ were no matches. Here is a simple example of a substitution test:
=abc=abc=\e=global
2: =xxx=xxx=
.sp
Subject and replacement strings should be kept relatively short for
substitution tests, as fixed-size buffers are used. To make it easy to test for
buffer overflow, if the replacement string starts with a number in square
brackets, that number is passed to \fBpcre2_substitute()\fP as the size of the
output buffer, with the replacement string starting at the next character. Here
is an example that tests the edge case:
Subject and replacement strings should be kept relatively short (fewer than 256
characters) for substitution tests, as fixed-size buffers are used. To make it
easy to test for buffer overflow, if the replacement string starts with a
number in square brackets, that number is passed to \fBpcre2_substitute()\fP as
the size of the output buffer, with the replacement string starting at the next
character. Here is an example that tests the edge case:
.sp
/abc/
123abc123\e=replace=[10]XYZ
@ -1606,6 +1609,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 05 November 2015
Last updated: 14 November 2015
Copyright (c) 1997-2015 University of Cambridge.
.fi