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