aboutsummaryrefslogtreecommitdiff
path: root/dist2/doc/html/pcre2unicode.html
diff options
context:
space:
mode:
Diffstat (limited to 'dist2/doc/html/pcre2unicode.html')
-rw-r--r--dist2/doc/html/pcre2unicode.html210
1 files changed, 44 insertions, 166 deletions
diff --git a/dist2/doc/html/pcre2unicode.html b/dist2/doc/html/pcre2unicode.html
index c11c7c2b..24f6d936 100644
--- a/dist2/doc/html/pcre2unicode.html
+++ b/dist2/doc/html/pcre2unicode.html
@@ -38,11 +38,10 @@ UNICODE PROPERTY SUPPORT
</b><br>
<P>
When PCRE2 is built with Unicode support, the escape sequences \p{..},
-\P{..}, and \X can be used. This is not dependent on the PCRE2_UTF setting.
-The Unicode properties that can be tested are limited to the general category
-properties such as Lu for an upper case letter or Nd for a decimal number, the
-Unicode script names such as Arabic or Han, and the derived properties Any and
-L&. Full lists are given in the
+\P{..}, and \X can be used. The Unicode properties that can be tested are
+limited to the general category properties such as Lu for an upper case letter
+or Nd for a decimal number, the Unicode script names such as Arabic or Han, and
+the derived properties Any and L&. Full lists are given in the
<a href="pcre2pattern.html"><b>pcre2pattern</b></a>
and
<a href="pcre2syntax.html"><b>pcre2syntax</b></a>
@@ -74,17 +73,11 @@ In UTF modes, the dot metacharacter matches one UTF character instead of a
single code unit.
</P>
<P>
-In UTF modes, capture group names are not restricted to ASCII, and may contain
-any Unicode letters and decimal digits, as well as underscore.
-</P>
-<P>
The escape sequence \C can be used to match a single code unit in a UTF mode,
but its use can lead to some strange effects because it breaks up multi-unit
characters (see the description of \C in the
<a href="pcre2pattern.html"><b>pcre2pattern</b></a>
-documentation). For this reason, there is a build-time option that disables
-support for \C completely. There is also a less draconian compile-time option
-for locking out the use of \C when a pattern is compiled.
+documentation).
</P>
<P>
The use of \C is not supported by the alternative matching function
@@ -131,150 +124,17 @@ for characters whose code points are less than 128 and that have at most two
case-equivalent values. For these, a direct table lookup is used for speed. A
few Unicode characters such as Greek sigma have more than two code points that
are case-equivalent, and these are treated as such.
-<a name="scriptruns"></a></P>
-<br><b>
-SCRIPT RUNS
-</b><br>
-<P>
-The pattern constructs (*script_run:...) and (*atomic_script_run:...), with
-synonyms (*sr:...) and (*asr:...), verify that the string matched within the
-parentheses is a script run. In concept, a script run is a sequence of
-characters that are all from the same Unicode script. However, because some
-scripts are commonly used together, and because some diacritical and other
-marks are used with multiple scripts, it is not that simple.
-</P>
-<P>
-Every Unicode character has a Script property, mostly with a value
-corresponding to the name of a script, such as Latin, Greek, or Cyrillic. There
-are also three special values:
-</P>
-<P>
-"Unknown" is used for code points that have not been assigned, and also for the
-surrogate code points. In the PCRE2 32-bit library, characters whose code
-points are greater than the Unicode maximum (U+10FFFF), which are accessible
-only in non-UTF mode, are assigned the Unknown script.
-</P>
-<P>
-"Common" is used for characters that are used with many scripts. These include
-punctuation, emoji, mathematical, musical, and currency symbols, and the ASCII
-digits 0 to 9.
-</P>
-<P>
-"Inherited" is used for characters such as diacritical marks that modify a
-previous character. These are considered to take on the script of the character
-that they modify.
-</P>
-<P>
-Some Inherited characters are used with many scripts, but many of them are only
-normally used with a small number of scripts. For example, U+102E0 (Coptic
-Epact thousands mark) is used only with Arabic and Coptic. In order to make it
-possible to check this, a Unicode property called Script Extension exists. Its
-value is a list of scripts that apply to the character. For the majority of
-characters, the list contains just one script, the same one as the Script
-property. However, for characters such as U+102E0 more than one Script is
-listed. There are also some Common characters that have a single, non-Common
-script in their Script Extension list.
-</P>
-<P>
-The next section describes the basic rules for deciding whether a given string
-of characters is a script run. Note, however, that there are some special cases
-involving the Chinese Han script, and an additional constraint for decimal
-digits. These are covered in subsequent sections.
-</P>
-<br><b>
-Basic script run rules
-</b><br>
-<P>
-A string that is less than two characters long is a script run. This is the
-only case in which an Unknown character can be part of a script run. Longer
-strings are checked using only the Script Extensions property, not the basic
-Script property.
-</P>
-<P>
-If a character's Script Extension property is the single value "Inherited", it
-is always accepted as part of a script run. This is also true for the property
-"Common", subject to the checking of decimal digits described below. All the
-remaining characters in a script run must have at least one script in common in
-their Script Extension lists. In set-theoretic terminology, the intersection of
-all the sets of scripts must not be empty.
-</P>
-<P>
-A simple example is an Internet name such as "google.com". The letters are all
-in the Latin script, and the dot is Common, so this string is a script run.
-However, the Cyrillic letter "o" looks exactly the same as the Latin "o"; a
-string that looks the same, but with Cyrillic "o"s is not a script run.
-</P>
-<P>
-More interesting examples involve characters with more than one script in their
-Script Extension. Consider the following characters:
-<pre>
- U+060C Arabic comma
- U+06D4 Arabic full stop
-</pre>
-The first has the Script Extension list Arabic, Hanifi Rohingya, Syriac, and
-Thaana; the second has just Arabic and Hanifi Rohingya. Both of them could
-appear in script runs of either Arabic or Hanifi Rohingya. The first could also
-appear in Syriac or Thaana script runs, but the second could not.
-</P>
-<br><b>
-The Chinese Han script
-</b><br>
-<P>
-The Chinese Han script is commonly used in conjunction with other scripts for
-writing certain languages. Japanese uses the Hiragana and Katakana scripts
-together with Han; Korean uses Hangul and Han; Taiwanese Mandarin uses Bopomofo
-and Han. These three combinations are treated as special cases when checking
-script runs and are, in effect, "virtual scripts". Thus, a script run may
-contain a mixture of Hiragana, Katakana, and Han, or a mixture of Hangul and
-Han, or a mixture of Bopomofo and Han, but not, for example, a mixture of
-Hangul and Bopomofo and Han. PCRE2 (like Perl) follows Unicode's Technical
-Standard 39 ("Unicode Security Mechanisms", http://unicode.org/reports/tr39/)
-in allowing such mixtures.
-</P>
-<br><b>
-Decimal digits
-</b><br>
-<P>
-Unicode contains many sets of 10 decimal digits in different scripts, and some
-scripts (including the Common script) contain more than one set. Some of these
-decimal digits them are visually indistinguishable from the common ASCII
-digits. In addition to the script checking described above, if a script run
-contains any decimal digits, they must all come from the same set of 10
-adjacent characters.
</P>
<br><b>
VALIDITY OF UTF STRINGS
</b><br>
<P>
When the PCRE2_UTF option is set, the strings passed as patterns and subjects
-are (by default) checked for validity on entry to the relevant functions. If an
-invalid UTF string is passed, an negative error code is returned. The code unit
-offset to the offending character can be extracted from the match data block by
-calling <b>pcre2_get_startchar()</b>, which is used for this purpose after a UTF
-error.
-</P>
-<P>
-In some situations, you may already know that your strings are valid, and
-therefore want to skip these checks in order to improve performance, for
-example in the case of a long subject string that is being scanned repeatedly.
-If you set the PCRE2_NO_UTF_CHECK option at compile time or at match time,
-PCRE2 assumes that the pattern or subject it is given (respectively) contains
-only valid UTF code unit sequences.
-</P>
-<P>
-If you pass an invalid UTF string when PCRE2_NO_UTF_CHECK is set, the result
-is usually undefined and your program may crash or loop indefinitely. There is,
-however, one mode of matching that can handle invalid UTF subject strings. This
-is matching via the JIT optimization using the PCRE2_JIT_INVALID_UTF option
-when calling <b>pcre2_jit_compile()</b>. For details, see the
-<a href="pcre2jit.html"><b>pcre2jit</b></a>
-documentation.
-</P>
-<P>
-Passing PCRE2_NO_UTF_CHECK to <b>pcre2_compile()</b> just disables the check for
-the pattern; it does not also apply to subject strings. If you want to disable
-the check for a subject string you must pass this same option to
-<b>pcre2_match()</b> or <b>pcre2_dfa_match()</b>.
+are (by default) checked for validity on entry to the relevant functions.
+If an invalid UTF string is passed, an negative error code is returned. The
+code unit offset to the offending character can be extracted from the match
+data block by calling <b>pcre2_get_startchar()</b>, which is used for this
+purpose after a UTF error.
</P>
<P>
UTF-16 and UTF-32 strings can indicate their endianness by special code knows
@@ -282,14 +142,13 @@ as a byte-order mark (BOM). The PCRE2 functions do not handle this, expecting
strings to be in host byte order.
</P>
<P>
-Unless PCRE2_NO_UTF_CHECK is set, a UTF string is checked before any other
-processing takes place. In the case of <b>pcre2_match()</b> and
-<b>pcre2_dfa_match()</b> calls with a non-zero starting offset, the check is
-applied only to that part of the subject that could be inspected during
-matching, and there is a check that the starting offset points to the first
-code unit of a character or to the end of the subject. If there are no
-lookbehind assertions in the pattern, the check starts at the starting offset.
-Otherwise, it starts at the length of the longest lookbehind before the
+A UTF string is checked before any other processing takes place. In the case of
+<b>pcre2_match()</b> and <b>pcre2_dfa_match()</b> calls with a non-zero starting
+offset, the check is applied only to that part of the subject that could be
+inspected during matching, and there is a check that the starting offset points
+to the first code unit of a character or to the end of the subject. If there
+are no lookbehind assertions in the pattern, the check starts at the starting
+offset. Otherwise, it starts at the length of the longest lookbehind before the
starting offset, or at the start of the subject if there are not that many
characters before the starting offset. Note that the sequences \b and \B are
one-character lookbehinds.
@@ -309,12 +168,31 @@ surrogate thing is a fudge for UTF-16 which unfortunately messes up UTF-8 and
UTF-32.)
</P>
<P>
-Setting PCRE2_NO_UTF_CHECK at compile time does not disable the error that is
-given if an escape sequence for an invalid Unicode code point is encountered in
-the pattern. If you want to allow escape sequences such as \x{d800} (a
-surrogate code point) you can set the PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES extra
-option. However, this is possible only in UTF-8 and UTF-32 modes, because these
-values are not representable in UTF-16.
+In some situations, you may already know that your strings are valid, and
+therefore want to skip these checks in order to improve performance, for
+example in the case of a long subject string that is being scanned repeatedly.
+If you set the PCRE2_NO_UTF_CHECK option at compile time or at match time,
+PCRE2 assumes that the pattern or subject it is given (respectively) contains
+only valid UTF code unit sequences.
+</P>
+<P>
+Passing PCRE2_NO_UTF_CHECK to <b>pcre2_compile()</b> just disables the check for
+the pattern; it does not also apply to subject strings. If you want to disable
+the check for a subject string you must pass this option to <b>pcre2_match()</b>
+or <b>pcre2_dfa_match()</b>.
+</P>
+<P>
+If you pass an invalid UTF string when PCRE2_NO_UTF_CHECK is set, the result
+is undefined and your program may crash or loop indefinitely.
+</P>
+<P>
+Note that setting PCRE2_NO_UTF_CHECK at compile time does not disable the error
+that is given if an escape sequence for an invalid Unicode code point is
+encountered in the pattern. If you want to allow escape sequences such as
+\x{d800} (a surrogate code point) you can set the
+PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES extra option. However, this is possible
+only in UTF-8 and UTF-32 modes, because these values are not representable in
+UTF-16.
<a name="utf8strings"></a></P>
<br><b>
Errors in UTF-8 strings
@@ -422,9 +300,9 @@ Cambridge, England.
REVISION
</b><br>
<P>
-Last updated: 06 March 2019
+Last updated: 02 September 2018
<br>
-Copyright &copy; 1997-2019 University of Cambridge.
+Copyright &copy; 1997-2018 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE2 index page</a>.