1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*
2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru**********************************************************************
31b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert*   Copyright (C) 2004-2015, International Business Machines
4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   Corporation and others.  All Rights Reserved.
5b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru**********************************************************************
650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho*   file name:  uregex.h
7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   encoding:   US-ASCII
8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   indentation:4
9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created on: 2004mar09
11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   created by: Andy Heninger
12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*
13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*   ICU Regular Expressions, API for C
14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/
15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
17b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file
18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \brief C API: Regular Expressions
19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>This is a C wrapper around the C++ RegexPattern and RegexMatcher classes.</p>
21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef UREGEX_H
24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define UREGEX_H
25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
2650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/utext.h"
27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h"
28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_REGULAR_EXPRESSIONS
30b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
3150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/localpointer.h"
32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/parseerr.h"
33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
34b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustruct URegularExpression;
35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
36b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Structure representing a compiled regular expression, plus the results
37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    of a match operation.
38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef struct URegularExpression URegularExpression;
41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Constants for Regular Expression Match Modes.
45b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.4
46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum URegexpFlag{
48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef U_HIDE_DRAFT_API
50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /** Forces normalization of pattern and strings.
51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    Not implemented yet, just a placeholder, hence draft.
52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    @draft ICU 2.4 */
53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UREGEX_CANON_EQ         = 128,
548393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius#endif /* U_HIDE_DRAFT_API */
55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**  Enable case insensitive matching.  @stable ICU 2.4 */
56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UREGEX_CASE_INSENSITIVE = 2,
57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**  Allow white space and comments within patterns  @stable ICU 2.4 */
59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UREGEX_COMMENTS         = 4,
60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**  If set, '.' matches line terminators,  otherwise '.' matching stops at line end.
62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *  @stable ICU 2.4 */
63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UREGEX_DOTALL           = 32,
64c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
65c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    /**  If set, treat the entire pattern as a literal string.
66c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      *  Metacharacters or escape sequences in the input sequence will be given
67103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius      *  no special meaning.
68c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      *
69103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius      *  The flag UREGEX_CASE_INSENSITIVE retains its impact
70c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      *  on matching when used in conjunction with this flag.
71c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      *  The other flags become superfluous.
72103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius      *
73b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru      * @stable ICU 4.0
74c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      */
75c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    UREGEX_LITERAL = 16,
76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**   Control behavior of "$" and "^"
78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *    If set, recognize line terminators within string,
79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *    otherwise, match only at start and end of input string.
80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *   @stable ICU 2.4 */
81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    UREGEX_MULTILINE        = 8,
82c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
83c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    /**   Unix-only line endings.
84b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru      *   When this mode is enabled, only \\u000a is recognized as a line ending
85c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      *    in the behavior of ., ^, and $.
86b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru      *   @stable ICU 4.0
87c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru      */
88c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    UREGEX_UNIX_LINES = 1,
89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru    /**  Unicode word boundaries.
91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *     If set, \b uses the Unicode TR 29 definition of word boundaries.
92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *     Warning: Unicode word boundaries are quite different from
93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *     traditional regular expression word boundaries.  See
94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *     http://unicode.org/reports/tr29/#Word_Boundaries
95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      *     @stable ICU 2.8
96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru      */
97c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru    UREGEX_UWORD            = 256,
98c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
99c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru     /**  Error on Unrecognized backslash escapes.
100c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru       *     If set, fail with an error on patterns that contain
101b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho       *     backslash-escaped ASCII letters without a known special
102c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru       *     meaning.  If this flag is not set, these
103c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru       *     escaped letters represent themselves.
104b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru       *     @stable ICU 4.0
105c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru       */
106c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru     UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512
107c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru}  URegexpFlag;
109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Open (compile) an ICU regular expression.  Compiles the regular expression in
112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  string form into an internal representation using the specified match mode flags.
113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  The resulting regular expression handle can then be used to perform various
114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   matching operations.
11550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param pattern        The Regular Expression pattern to be compiled.
118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param patternLength  The length of the pattern, or -1 if the pattern is
119b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                       NUL terminated.
120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param flags          Flags that alter the default matching behavior for
121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       the regular expression, UREGEX_CASE_INSENSITIVE, for
122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       example.  For default behavior, set this parameter to zero.
123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       See <code>enum URegexpFlag</code>.  All desired flags
124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       are bitwise-ORed together.
125b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param pe             Receives the position (line and column numbers) of any syntax
126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       error within the source regular expression string.  If this
127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       information is not wanted, pass NULL for this parameter.
128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param status         Receives error detected by this function.
129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE URegularExpression * U_EXPORT2
133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_open( const  UChar          *pattern,
134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    int32_t         patternLength,
135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    uint32_t        flags,
136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UParseError    *pe,
137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode     *status);
138103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
13950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
14050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  Open (compile) an ICU regular expression.  Compiles the regular expression in
14150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  string form into an internal representation using the specified match mode flags.
14250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  The resulting regular expression handle can then be used to perform various
14350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   matching operations.
14450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  <p>
14550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  The contents of the pattern UText will be extracted and saved. Ownership of the
14650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   UText struct itself remains with the caller. This is to match the behavior of
14750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   uregex_open().
14850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
14950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param pattern        The Regular Expression pattern to be compiled.
15050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param flags          Flags that alter the default matching behavior for
15150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       the regular expression, UREGEX_CASE_INSENSITIVE, for
15250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       example.  For default behavior, set this parameter to zero.
15350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       See <code>enum URegexpFlag</code>.  All desired flags
15450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       are bitwise-ORed together.
155b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param pe             Receives the position (line and column numbers) of any syntax
15650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       error within the source regular expression string.  If this
15750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                       information is not wanted, pass NULL for this parameter.
15850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param status         Receives error detected by this function.
15950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
160103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
16150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
16254dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE URegularExpression *  U_EXPORT2
16350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_openUText(UText          *pattern,
16450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                 uint32_t        flags,
16550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                 UParseError    *pe,
16650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                 UErrorCode     *status);
167103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Open (compile) an ICU regular expression.  The resulting regular expression
170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   handle can then be used to perform various matching operations.
171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  <p>
172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   This function is the same as uregex_open, except that the pattern
173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   is supplied as an 8 bit char * string in the default code page.
174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param pattern        The Regular Expression pattern to be compiled,
176b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                       NUL terminated.
177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param flags          Flags that alter the default matching behavior for
178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       the regular expression, UREGEX_CASE_INSENSITIVE, for
179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       example.  For default behavior, set this parameter to zero.
180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       See <code>enum URegexpFlag</code>.  All desired flags
181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       are bitwise-ORed together.
182b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param pe             Receives the position (line and column numbers) of any syntax
183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       error within the source regular expression string.  If this
184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       information is not wanted, pass NULL for this parameter.
185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param status         Receives errors detected by this function.
186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @return               The URegularExpression object representing the compiled
187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                       pattern.
188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#if !UCONFIG_NO_CONVERSION
192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE URegularExpression * U_EXPORT2
193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_openC( const char           *pattern,
194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    uint32_t        flags,
195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UParseError    *pe,
196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode     *status);
197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif
198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Close the regular expression, recovering all resources (memory) it
203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   was holding.
204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param regexp   The regular expression to be closed.
206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_close(URegularExpression *regexp);
210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
21150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if U_SHOW_CPLUSPLUS_API
21250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
21350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_BEGIN
21450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
21550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
21650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \class LocalURegularExpressionPointer
21750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * "Smart pointer" class, closes a URegularExpression via uregex_close().
21850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * For most methods see the LocalPointerBase base class.
21950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
22050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointerBase
22150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointer
22227f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4
22350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */
22450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
22550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
22650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_END
22750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
22850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif
22950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Make a copy of a compiled regular expression.  Cloning a regular
232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * expression is faster than opening a second instance from the source
233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * form of the expression, and requires less memory.
234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note that the current input string and the position of any matched text
236b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho *  within it are not cloned; only the pattern itself and the
237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *  match mode flags are copied.
238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>
239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Cloning can be particularly useful to threaded applications that perform
240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * multiple match operations in parallel.  Each concurrent RE
241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * operation requires its own instance of a URegularExpression.
242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp   The compiled regular expression to be cloned.
244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status   Receives indication of any errors encountered
245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the cloned copy of the compiled regular expression.
246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE URegularExpression * U_EXPORT2
249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_clone(const URegularExpression *regexp, UErrorCode *status);
250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
25250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *  Returns a pointer to the source form of the pattern for this regular expression.
25350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *  This function will work even if the pattern was originally specified as a UText.
254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *
255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp     The compiled regular expression.
256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param patLength  This output parameter will be set to the length of the
257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   pattern string.  A NULL pointer may be used here if the
258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   pattern length is not needed, as would be the case if
259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   the pattern is known in advance to be a NUL terminated
260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   string.
261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status     Receives errors detected by this function.
262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to the pattern string.  The storage for the string is
263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   owned by the regular expression object, and must not be
264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   altered or deleted by the application.  The returned string
265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *                   will remain valid until the regular expression is closed.
266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0
267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */
268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const UChar * U_EXPORT2
26950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_pattern(const URegularExpression *regexp,
27050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                     int32_t            *patLength,
27150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                     UErrorCode         *status);
27250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
27350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
27450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *  Returns the source text of the pattern for this regular expression.
27550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *  This function will work even if the pattern was originally specified as a UChar string.
27650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
27750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp     The compiled regular expression.
27850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status     Receives errors detected by this function.
27950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return the pattern text.  The storage for the text is owned by the regular expression
28050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *                   object, and must not be altered or deleted.
28150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho *
282103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
28350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */
28454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
28550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_patternUText(const URegularExpression *regexp,
28650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                          UErrorCode         *status);
287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * Get the match mode flags that were specified when compiling this regular expression.
290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param status   Receives errors detected by this function.
291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param regexp   The compiled regular expression.
292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @return         The match mode flags
293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @see URegexpFlag
294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
295b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_flags(const  URegularExpression   *regexp,
298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode           *status);
299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
301b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Set the subject text string upon which the regular expression will look for matches.
303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  This function may be called any number of times, allowing the regular
304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  expression pattern to be applied to different strings.
305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  <p>
306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Regular expression matching operations work directly on the application's
307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  string data.  No copy is made.  The subject string data must not be
308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  altered after calling this function until after all regular expression
309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  operations involving this string data are completed.
310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  <p>
311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Zero length strings are permitted.  In this case, no subsequent match
312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  operation will dereference the text string pointer.
313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param regexp     The compiled regular expression.
315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param text       The subject text string.
316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param textLength The length of the subject text, or -1 if the string
317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                   is NUL terminated.
318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param status     Receives errors detected by this function.
319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_setText(URegularExpression *regexp,
323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               const UChar        *text,
324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               int32_t             textLength,
325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               UErrorCode         *status);
326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
32750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
32850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
32950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  Set the subject text string upon which the regular expression will look for matches.
33050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  This function may be called any number of times, allowing the regular
33150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  expression pattern to be applied to different strings.
33250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  <p>
33350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  Regular expression matching operations work directly on the application's
33450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  string data; only a shallow clone is made.  The subject string data must not be
33550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  altered after calling this function until after all regular expression
33650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  operations involving this string data are completed.
33750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
33850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param regexp     The compiled regular expression.
33950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param text       The subject text string.
34050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param status     Receives errors detected by this function.
34150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
342103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
34350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
34454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
34550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_setUText(URegularExpression *regexp,
34650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                UText              *text,
34750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                UErrorCode         *status);
34850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Get the subject text that is currently associated with this
35150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   regular expression object.  If the input was supplied using uregex_setText(),
35250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   that pointer will be returned.  Otherwise, the characters in the input will
35350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   be extracted to a buffer and returned.  In either case, ownership remains
35450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   with the regular expression object.
35550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
35650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  This function will work even if the input was originally specified as a UText.
357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param regexp      The compiled regular expression.
359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param textLength  The length of the string is returned in this output parameter.
360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                    A NULL pointer may be used here if the
361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                    text length is not needed, as would be the case if
362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                    the text is known in advance to be a NUL terminated
363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                    string.
364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @param status      Receives errors detected by this function.
36550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @return            Pointer to the subject text string currently associated with
366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                    this regular expression.
367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * @stable ICU 3.0
368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const UChar * U_EXPORT2
370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_getText(URegularExpression *regexp,
371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               int32_t            *textLength,
372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru               UErrorCode         *status);
373103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
37450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
37550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  Get the subject text that is currently associated with this
37650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   regular expression object.
37750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
37850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  This function will work even if the input was originally specified as a UChar string.
37950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
38050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param regexp      The compiled regular expression.
38150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param dest        A mutable UText in which to store the current input.
38250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                    If NULL, a new UText will be created as an immutable shallow clone
38350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                    of the actual input string.
38450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @param status      Receives errors detected by this function.
38550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * @return            The subject text currently associated with this regular expression.
38650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                    If a pre-allocated UText was provided, it will always be used and returned.
38750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
388103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
38950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
39054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
39150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_getUText(URegularExpression *regexp,
39250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                UText              *dest,
39350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                UErrorCode         *status);
394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
3952e615e9896b12236afe0ff2695e8afc2ee73f961claireho/**
3962e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  Set the subject text string upon which the regular expression is looking for matches
3972e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  without changing any other aspect of the matching state.
3982e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  The new and previous text strings must have the same content.
3992e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *
400b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  This function is intended for use in environments where ICU is operating on
4012e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  strings that may move around in memory.  It provides a mechanism for notifying
4022e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  ICU that the string has been relocated, and providing a new UText to access the
4032e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *  string in its new position.
4042e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *
405b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  Note that the regular expression implementation never copies the underlying text
406b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  of a string being matched, but always operates directly on the original text
407b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  provided by the user. Refreshing simply drops the references to the old text
408b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  and replaces them with references to the new.
409b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
410b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  Caution:  this function is normally used only by very specialized
411b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *            system-level code.   One example use case is with garbage collection
412b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *            that moves the text in memory.
4132e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *
4142e615e9896b12236afe0ff2695e8afc2ee73f961claireho  * @param regexp     The compiled regular expression.
4152e615e9896b12236afe0ff2695e8afc2ee73f961claireho  * @param text       The new (moved) text string.
4162e615e9896b12236afe0ff2695e8afc2ee73f961claireho  * @param status     Receives errors detected by this function.
4172e615e9896b12236afe0ff2695e8afc2ee73f961claireho  *
41854dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius  * @stable ICU 4.8
4192e615e9896b12236afe0ff2695e8afc2ee73f961claireho  */
42054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
4212e615e9896b12236afe0ff2695e8afc2ee73f961clairehouregex_refreshUText(URegularExpression *regexp,
4222e615e9896b12236afe0ff2695e8afc2ee73f961claireho                    UText              *text,
4232e615e9896b12236afe0ff2695e8afc2ee73f961claireho                    UErrorCode         *status);
4242e615e9896b12236afe0ff2695e8afc2ee73f961claireho
425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
426c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   Attempts to match the input string against the pattern.
427c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   To succeed, the match must extend to the end of the string,
428c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   or cover the complete match region.
429c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
430c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   If startIndex >= zero the match operation starts at the specified
431c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   index and must extend to the end of the input string.  Any region
432c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   that has been specified is reset.
433c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
434c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   If startIndex == -1 the match must cover the input region, or the entire
435c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   input string if no region has been set.  This directly corresponds to
436c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   Matcher.matches() in Java
437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param  regexp      The compiled regular expression.
43927f654740f2a26ad62a5c155af9199af9e69b889claireho  *    @param  startIndex  The input string (native) index at which to begin matching, or -1
440c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *                        to match the input Region.
441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param  status      Receives errors detected by this function.
442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @return             TRUE if there is a match
443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_matches(URegularExpression *regexp,
447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                int32_t            startIndex,
448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode        *status);
449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
45127f654740f2a26ad62a5c155af9199af9e69b889claireho  *   64bit version of uregex_matches.
452b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Attempts to match the input string against the pattern.
453b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   To succeed, the match must extend to the end of the string,
454b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   or cover the complete match region.
455b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
456b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   If startIndex >= zero the match operation starts at the specified
457b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   index and must extend to the end of the input string.  Any region
458b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   that has been specified is reset.
459b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
460b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   If startIndex == -1 the match must cover the input region, or the entire
461b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   input string if no region has been set.  This directly corresponds to
462b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Matcher.matches() in Java
463b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
464b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param  regexp      The compiled regular expression.
465b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param  startIndex  The input string (native) index at which to begin matching, or -1
466b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                        to match the input Region.
467b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param  status      Receives errors detected by this function.
468b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @return             TRUE if there is a match
469103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
47027f654740f2a26ad62a5c155af9199af9e69b889claireho  */
47154dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UBool U_EXPORT2
47227f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_matches64(URegularExpression *regexp,
47327f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t            startIndex,
47427f654740f2a26ad62a5c155af9199af9e69b889claireho                 UErrorCode        *status);
47527f654740f2a26ad62a5c155af9199af9e69b889claireho
47627f654740f2a26ad62a5c155af9199af9e69b889claireho/**
477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Attempts to match the input string, starting from the specified index, against the pattern.
478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   The match may be of any length, and is not required to extend to the end
479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   of the input string.  Contrast with uregex_matches().
480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
481c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   <p>If startIndex is >= 0 any input region that was set for this
482c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   URegularExpression is reset before the operation begins.
483c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
484c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   <p>If the specified starting index == -1 the match begins at the start of the input
485c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   region, or at the start of the full string if no region has been specified.
486c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   This corresponds directly with Matcher.lookingAt() in Java.
487c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   <p>If the match succeeds then more information can be obtained via the
489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    <code>uregexp_start()</code>, <code>uregexp_end()</code>,
490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    and <code>uregexp_group()</code> functions.</p>
491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp      The compiled regular expression.
49327f654740f2a26ad62a5c155af9199af9e69b889claireho  *    @param   startIndex  The input string (native) index at which to begin matching, or
494c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *                         -1 to match the Input Region
495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status      A reference to a UErrorCode to receive any errors.
496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @return  TRUE if there is a match.
497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_lookingAt(URegularExpression *regexp,
501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 int32_t             startIndex,
502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                 UErrorCode         *status);
503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
50527f654740f2a26ad62a5c155af9199af9e69b889claireho  *   64bit version of uregex_lookingAt.
506b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Attempts to match the input string, starting from the specified index, against the pattern.
507b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   The match may be of any length, and is not required to extend to the end
508b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   of the input string.  Contrast with uregex_matches().
509b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
510b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   <p>If startIndex is >= 0 any input region that was set for this
511b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   URegularExpression is reset before the operation begins.
512b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
513b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   <p>If the specified starting index == -1 the match begins at the start of the input
514b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   region, or at the start of the full string if no region has been specified.
515b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   This corresponds directly with Matcher.lookingAt() in Java.
516b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
517b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   <p>If the match succeeds then more information can be obtained via the
518b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    <code>uregexp_start()</code>, <code>uregexp_end()</code>,
519b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    and <code>uregexp_group()</code> functions.</p>
520b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
521b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   regexp      The compiled regular expression.
522b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   startIndex  The input string (native) index at which to begin matching, or
523b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                         -1 to match the Input Region
524b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   status      A reference to a UErrorCode to receive any errors.
525b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @return  TRUE if there is a match.
526103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *    @stable ICU 4.6
52727f654740f2a26ad62a5c155af9199af9e69b889claireho  */
52854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UBool U_EXPORT2
52927f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_lookingAt64(URegularExpression *regexp,
53027f654740f2a26ad62a5c155af9199af9e69b889claireho                   int64_t             startIndex,
53127f654740f2a26ad62a5c155af9199af9e69b889claireho                   UErrorCode         *status);
53227f654740f2a26ad62a5c155af9199af9e69b889claireho
53327f654740f2a26ad62a5c155af9199af9e69b889claireho/**
534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Find the first matching substring of the input string that matches the pattern.
535c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   If startIndex is >= zero the search for a match begins at the specified index,
536c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *          and any match region is reset.  This corresponds directly with
537c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *          Matcher.find(startIndex) in Java.
538c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
539c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *   If startIndex == -1 the search begins at the start of the input region,
540c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *           or at the start of the full string if no region has been specified.
541c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   If a match is found, <code>uregex_start(), uregex_end()</code>, and
543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   <code>uregex_group()</code> will provide more information regarding the match.
544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   regexp      The compiled regular expression.
54627f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @param   startIndex  The position (native) in the input string to begin the search, or
547c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *                        -1 to search within the Input Region.
548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   status      A reference to a UErrorCode to receive any errors.
549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @return              TRUE if a match is found.
550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @stable ICU 3.0
551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_find(URegularExpression *regexp,
554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            int32_t             startIndex,
555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru            UErrorCode         *status);
556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
55827f654740f2a26ad62a5c155af9199af9e69b889claireho  *   64bit version of uregex_find.
559b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Find the first matching substring of the input string that matches the pattern.
560b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   If startIndex is >= zero the search for a match begins at the specified index,
561b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *          and any match region is reset.  This corresponds directly with
562b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *          Matcher.find(startIndex) in Java.
563b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
564b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   If startIndex == -1 the search begins at the start of the input region,
565b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *           or at the start of the full string if no region has been specified.
566b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
567b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   If a match is found, <code>uregex_start(), uregex_end()</code>, and
568b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   <code>uregex_group()</code> will provide more information regarding the match.
569b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
570b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   @param   regexp      The compiled regular expression.
571b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   @param   startIndex  The position (native) in the input string to begin the search, or
572b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                        -1 to search within the Input Region.
573b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   @param   status      A reference to a UErrorCode to receive any errors.
574b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   @return              TRUE if a match is found.
575103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
57627f654740f2a26ad62a5c155af9199af9e69b889claireho  */
57754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UBool U_EXPORT2
57827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_find64(URegularExpression *regexp,
57927f654740f2a26ad62a5c155af9199af9e69b889claireho              int64_t             startIndex,
58027f654740f2a26ad62a5c155af9199af9e69b889claireho              UErrorCode         *status);
58127f654740f2a26ad62a5c155af9199af9e69b889claireho
58227f654740f2a26ad62a5c155af9199af9e69b889claireho/**
583c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  Find the next pattern match in the input string.  Begin searching
584c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  the input at the location following the end of he previous match,
585c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  or at the start of the string (or region) if there is no
586c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  previous match.  If a match is found, <code>uregex_start(), uregex_end()</code>, and
587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  <code>uregex_group()</code> will provide more information regarding the match.
588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  @param   regexp      The compiled regular expression.
590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  @param   status      A reference to a UErrorCode to receive any errors.
591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  @return              TRUE if a match is found.
592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  @see uregex_reset
593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  @stable ICU 3.0
594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UBool U_EXPORT2
596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_findNext(URegularExpression *regexp,
597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                UErrorCode         *status);
598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Get the number of capturing groups in this regular expression's pattern.
601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   regexp      The compiled regular expression.
602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   status      A reference to a UErrorCode to receive any errors.
603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @return the number of capture groups
604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @stable ICU 3.0
605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_groupCount(URegularExpression *regexp,
608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode         *status);
609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
6101b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#ifndef U_HIDE_DRAFT_API
6111b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert/**
6121b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * Get the group number corresponding to a named capture group.
6131b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * The returned number can be used with any function that access
6141b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * capture groups by number.
6151b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6161b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * The function returns an error status if the specified name does not
6171b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * appear in the pattern.
6181b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6191b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  regexp      The compiled regular expression.
6201b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  groupName   The capture group name.
6211b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  nameLength  The length of the name, or -1 if the name is a
6221b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *                     nul-terminated string.
6231b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  status      A pointer to a UErrorCode to receive any errors.
6241b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6251b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @draft ICU 55
6261b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  */
6271b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DRAFT int32_t U_EXPORT2
6281b7d32f919554dda9c193b32188251337bc756f1Fredrik Rouberturegex_groupNumberFromName(URegularExpression *regexp,
6291b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                           const UChar        *groupName,
6301b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                           int32_t             nameLength,
6311b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                           UErrorCode          *status);
6321b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
6331b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
6341b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert/**
6351b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * Get the group number corresponding to a named capture group.
6361b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * The returned number can be used with any function that access
6371b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * capture groups by number.
6381b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6391b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * The function returns an error status if the specified name does not
6401b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * appear in the pattern.
6411b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6421b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  regexp      The compiled regular expression.
6431b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  groupName   The capture group name,
6441b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *                     platform invariant characters only.
6451b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  nameLength  The length of the name, or -1 if the name is
6461b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *                     nul-terminated.
6471b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @param  status      A pointer to a UErrorCode to receive any errors.
6481b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *
6491b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  * @draft ICU 55
6501b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  */
6511b7d32f919554dda9c193b32188251337bc756f1Fredrik RoubertU_DRAFT int32_t U_EXPORT2
6521b7d32f919554dda9c193b32188251337bc756f1Fredrik Rouberturegex_groupNumberFromCName(URegularExpression *regexp,
6531b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                            const char         *groupName,
6541b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                            int32_t             nameLength,
6551b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert                            UErrorCode          *status);
6561b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert#endif  /* U_HIDE_DRAFT_API */
6571b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert
658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Extract the string for the specified matching expression or subexpression.
659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * Group #0 is the complete string of matched text.
660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * Group #1 is the text matched by the first set of capturing parentheses.
661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   regexp       The compiled regular expression.
663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   groupNum     The capture group to extract.  Group 0 is the complete
664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         match.  The value of this parameter must be
665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         less than or equal to the number of capture groups in
666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         the pattern.
667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   dest         Buffer to receive the matching string data
668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   destCapacity Capacity of the dest buffer.
669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   status       A reference to a UErrorCode to receive any errors.
670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @return               Length of matching data,
671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         or -1 if no applicable match.
672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @stable ICU 3.0
673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_group(URegularExpression *regexp,
676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             int32_t             groupNum,
677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             UChar              *dest,
678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             int32_t             destCapacity,
679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             UErrorCode          *status);
680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
6811b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert/** Returns a shallow immutable clone of the entire input string with the current index set
6821b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *   to the beginning of the requested capture group.  The capture group length is also
68327f654740f2a26ad62a5c155af9199af9e69b889claireho  *   returned via groupLength.
68427f654740f2a26ad62a5c155af9199af9e69b889claireho  * Group #0 is the complete string of matched text.
68527f654740f2a26ad62a5c155af9199af9e69b889claireho  * Group #1 is the text matched by the first set of capturing parentheses.
68627f654740f2a26ad62a5c155af9199af9e69b889claireho  *
68727f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @param   regexp       The compiled regular expression.
68827f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @param   groupNum     The capture group to extract.  Group 0 is the complete
68927f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         match.  The value of this parameter must be
69027f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         less than or equal to the number of capture groups in
69127f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         the pattern.
69227f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @param   dest         A mutable UText in which to store the current input.
69327f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         If NULL, a new UText will be created as an immutable shallow clone
69427f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         of the entire input string.
6951b7d32f919554dda9c193b32188251337bc756f1Fredrik Roubert  *   @param   groupLength  The group length of the desired capture group. Output parameter.
69627f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @param   status       A reference to a UErrorCode to receive any errors.
69727f654740f2a26ad62a5c155af9199af9e69b889claireho  *   @return               The subject text currently associated with this regular expression.
69827f654740f2a26ad62a5c155af9199af9e69b889claireho  *                         If a pre-allocated UText was provided, it will always be used and returned.
69927f654740f2a26ad62a5c155af9199af9e69b889claireho
70027f654740f2a26ad62a5c155af9199af9e69b889claireho  *
701103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
70227f654740f2a26ad62a5c155af9199af9e69b889claireho  */
70354dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
70427f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_groupUText(URegularExpression *regexp,
70527f654740f2a26ad62a5c155af9199af9e69b889claireho                  int32_t             groupNum,
70627f654740f2a26ad62a5c155af9199af9e69b889claireho                  UText              *dest,
70727f654740f2a26ad62a5c155af9199af9e69b889claireho                  int64_t            *groupLength,
70827f654740f2a26ad62a5c155af9199af9e69b889claireho                  UErrorCode         *status);
70927f654740f2a26ad62a5c155af9199af9e69b889claireho
710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Returns the index in the input string of the start of the text matched by the
712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   specified capture group during the previous match operation.  Return -1 if
713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   the capture group was not part of the last match.
714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Group #0 refers to the complete range of matched text.
715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Group #1 refers to the text matched by the first set of capturing parentheses.
716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp      The compiled regular expression.
718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   groupNum    The capture group number
719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status      A reference to a UErrorCode to receive any errors.
72027f654740f2a26ad62a5c155af9199af9e69b889claireho  *    @return              the starting (native) position in the input of the text matched
721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         by the specified group.
722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_start(URegularExpression *regexp,
726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             int32_t             groupNum,
727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             UErrorCode          *status);
728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
73027f654740f2a26ad62a5c155af9199af9e69b889claireho  *   64bit version of uregex_start.
731b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Returns the index in the input string of the start of the text matched by the
732b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   specified capture group during the previous match operation.  Return -1 if
733b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   the capture group was not part of the last match.
734b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Group #0 refers to the complete range of matched text.
735b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Group #1 refers to the text matched by the first set of capturing parentheses.
736b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
737b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   regexp      The compiled regular expression.
738b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   groupNum    The capture group number
739b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   status      A reference to a UErrorCode to receive any errors.
740b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @return              the starting (native) position in the input of the text matched
741b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                         by the specified group.
742103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
74327f654740f2a26ad62a5c155af9199af9e69b889claireho  */
74454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2
74527f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_start64(URegularExpression *regexp,
74627f654740f2a26ad62a5c155af9199af9e69b889claireho               int32_t             groupNum,
74727f654740f2a26ad62a5c155af9199af9e69b889claireho               UErrorCode          *status);
74827f654740f2a26ad62a5c155af9199af9e69b889claireho
74927f654740f2a26ad62a5c155af9199af9e69b889claireho/**
750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Returns the index in the input string of the position following the end
751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   of the text matched by the specified capture group.
752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Return -1 if the capture group was not part of the last match.
753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Group #0 refers to the complete range of matched text.
754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Group #1 refers to the text matched by the first set of capturing parentheses.
755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp      The compiled regular expression.
757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   groupNum    The capture group number
758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status      A reference to a UErrorCode to receive any errors.
75927f654740f2a26ad62a5c155af9199af9e69b889claireho  *    @return              the (native) index of the position following the last matched character.
760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_end(URegularExpression   *regexp,
764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           int32_t               groupNum,
765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru           UErrorCode           *status);
766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
76827f654740f2a26ad62a5c155af9199af9e69b889claireho  *   64bit version of uregex_end.
769b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Returns the index in the input string of the position following the end
770b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   of the text matched by the specified capture group.
771b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Return -1 if the capture group was not part of the last match.
772b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Group #0 refers to the complete range of matched text.
773b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   Group #1 refers to the text matched by the first set of capturing parentheses.
774b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
775b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   regexp      The compiled regular expression.
776b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   groupNum    The capture group number
777b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   status      A reference to a UErrorCode to receive any errors.
778b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @return              the (native) index of the position following the last matched character.
779103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
78027f654740f2a26ad62a5c155af9199af9e69b889claireho  */
78154dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2
78227f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_end64(URegularExpression *regexp,
78327f654740f2a26ad62a5c155af9199af9e69b889claireho             int32_t               groupNum,
78427f654740f2a26ad62a5c155af9199af9e69b889claireho             UErrorCode           *status);
78527f654740f2a26ad62a5c155af9199af9e69b889claireho
78627f654740f2a26ad62a5c155af9199af9e69b889claireho/**
787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  Reset any saved state from the previous match.  Has the effect of
788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  causing uregex_findNext to begin at the specified index, and causing
789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  uregex_start(), uregex_end() and uregex_group() to return an error
790c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  indicating that there is no match information available.  Clears any
791c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  match region that may have been set.
792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp      The compiled regular expression.
79427f654740f2a26ad62a5c155af9199af9e69b889claireho  *    @param   index       The position (native) in the text at which a
795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                         uregex_findNext() should begin searching.
796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status      A reference to a UErrorCode to receive any errors.
797b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
798b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2
800b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_reset(URegularExpression    *regexp,
801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             int32_t               index,
802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru             UErrorCode            *status);
803103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
80427f654740f2a26ad62a5c155af9199af9e69b889claireho/**
805b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  64bit version of uregex_reset.
806b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  Reset any saved state from the previous match.  Has the effect of
807b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  causing uregex_findNext to begin at the specified index, and causing
808b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  uregex_start(), uregex_end() and uregex_group() to return an error
809b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  indicating that there is no match information available.  Clears any
810b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  match region that may have been set.
811b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
812b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   regexp      The compiled regular expression.
813b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   index       The position (native) in the text at which a
814b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                         uregex_findNext() should begin searching.
815b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   status      A reference to a UErrorCode to receive any errors.
816103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *    @stable ICU 4.6
81727f654740f2a26ad62a5c155af9199af9e69b889claireho  */
81854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
81927f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_reset64(URegularExpression  *regexp,
82027f654740f2a26ad62a5c155af9199af9e69b889claireho               int64_t               index,
82127f654740f2a26ad62a5c155af9199af9e69b889claireho               UErrorCode            *status);
82227f654740f2a26ad62a5c155af9199af9e69b889claireho
823b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho/**
824b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Sets the limits of the matching region for this URegularExpression.
825c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * The region is the part of the input string that will be considered when matching.
826c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Invoking this method resets any saved state from the previous match,
827c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * then sets the region to start at the index specified by the start parameter
828c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * and end at the index specified by the end parameter.
829c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
830c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Depending on the transparency and anchoring being used (see useTransparentBounds
831c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * and useAnchoringBounds), certain constructs such as anchors may behave differently
832c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * at or around the boundaries of the region
833c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
834c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * The function will fail if start is greater than limit, or if either index
835c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  is less than zero or greater than the length of the string being matched.
836c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
837c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
83827f654740f2a26ad62a5c155af9199af9e69b889claireho  * @param regionStart  The (native) index to begin searches at.
83927f654740f2a26ad62a5c155af9199af9e69b889claireho  * @param regionLimit  The (native) index to end searches at (exclusive).
840c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
841b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
842c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
84350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
844c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setRegion(URegularExpression   *regexp,
845c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                 int32_t               regionStart,
846c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                 int32_t               regionLimit,
847c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                 UErrorCode           *status);
848c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
849c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
850b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * 64bit version of uregex_setRegion.
851b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Sets the limits of the matching region for this URegularExpression.
852b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * The region is the part of the input string that will be considered when matching.
853b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Invoking this method resets any saved state from the previous match,
854b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * then sets the region to start at the index specified by the start parameter
855b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * and end at the index specified by the end parameter.
856b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
857b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Depending on the transparency and anchoring being used (see useTransparentBounds
858b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * and useAnchoringBounds), certain constructs such as anchors may behave differently
859b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * at or around the boundaries of the region
860b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
861b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * The function will fail if start is greater than limit, or if either index
862b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  is less than zero or greater than the length of the string being matched.
863b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
864b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regexp The compiled regular expression.
865b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regionStart  The (native) index to begin searches at.
866b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regionLimit  The (native) index to end searches at (exclusive).
867b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param status A pointer to a UErrorCode to receive any errors.
868103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
86927f654740f2a26ad62a5c155af9199af9e69b889claireho  */
87054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
87127f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setRegion64(URegularExpression *regexp,
87227f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t               regionStart,
87327f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t               regionLimit,
87427f654740f2a26ad62a5c155af9199af9e69b889claireho                 UErrorCode           *status);
87527f654740f2a26ad62a5c155af9199af9e69b889claireho
87627f654740f2a26ad62a5c155af9199af9e69b889claireho/**
877b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  Set the matching region and the starting index for subsequent matches
878b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  in a single operation.
879b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  This is useful because the usual function for setting the starting
880b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *  index, urgex_reset(), also resets any region limits.
881b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
882b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regexp The compiled regular expression.
883b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regionStart  The (native) index to begin searches at.
884b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regionLimit  The (native) index to end searches at (exclusive).
885b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param startIndex   The index in the input text at which the next
886b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *                     match operation should begin.
887b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param status A pointer to a UErrorCode to receive any errors.
888103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
88927f654740f2a26ad62a5c155af9199af9e69b889claireho  */
89054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
89127f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setRegionAndStart(URegularExpression *regexp,
89227f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t               regionStart,
89327f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t               regionLimit,
89427f654740f2a26ad62a5c155af9199af9e69b889claireho                 int64_t               startIndex,
89527f654740f2a26ad62a5c155af9199af9e69b889claireho                 UErrorCode           *status);
89627f654740f2a26ad62a5c155af9199af9e69b889claireho
89727f654740f2a26ad62a5c155af9199af9e69b889claireho/**
898c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Reports the start index of the matching region. Any matches found are limited to
899c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * to the region bounded by regionStart (inclusive) and regionEnd (exclusive).
900c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
901c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
902c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
90327f654740f2a26ad62a5c155af9199af9e69b889claireho  * @return The starting (native) index of this matcher's region.
904b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
905c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
90650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2
907c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_regionStart(const  URegularExpression   *regexp,
908c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                          UErrorCode           *status);
909c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
91027f654740f2a26ad62a5c155af9199af9e69b889claireho/**
911b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * 64bit version of uregex_regionStart.
912b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Reports the start index of the matching region. Any matches found are limited to
913b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * to the region bounded by regionStart (inclusive) and regionEnd (exclusive).
914b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
915b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regexp The compiled regular expression.
916b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param status A pointer to a UErrorCode to receive any errors.
917b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @return The starting (native) index of this matcher's region.
918103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
91927f654740f2a26ad62a5c155af9199af9e69b889claireho  */
92054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2
92127f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_regionStart64(const  URegularExpression   *regexp,
92227f654740f2a26ad62a5c155af9199af9e69b889claireho                            UErrorCode           *status);
923c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
924c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
925c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Reports the end index (exclusive) of the matching region for this URegularExpression.
926c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Any matches found are limited to to the region bounded by regionStart (inclusive)
927c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * and regionEnd (exclusive).
928c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
929c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
930c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
93127f654740f2a26ad62a5c155af9199af9e69b889claireho  * @return The ending point (native) of this matcher's region.
932b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
933c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
93450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2
935c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_regionEnd(const  URegularExpression   *regexp,
936c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        UErrorCode           *status);
937c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
938c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
939b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * 64bit version of uregex_regionEnd.
940b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Reports the end index (exclusive) of the matching region for this URegularExpression.
941b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * Any matches found are limited to to the region bounded by regionStart (inclusive)
942b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * and regionEnd (exclusive).
943b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
944b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param regexp The compiled regular expression.
945b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @param status A pointer to a UErrorCode to receive any errors.
946b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  * @return The ending point (native) of this matcher's region.
947103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  * @stable ICU 4.6
94827f654740f2a26ad62a5c155af9199af9e69b889claireho  */
94954dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2
95027f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_regionEnd64(const  URegularExpression   *regexp,
95127f654740f2a26ad62a5c155af9199af9e69b889claireho                          UErrorCode           *status);
95227f654740f2a26ad62a5c155af9199af9e69b889claireho
95327f654740f2a26ad62a5c155af9199af9e69b889claireho/**
954c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Queries the transparency of region bounds for this URegularExpression.
955c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * See useTransparentBounds for a description of transparent and opaque bounds.
956c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * By default, matching boundaries are opaque.
957c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
958c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
959c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
960c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @return TRUE if this matcher is using opaque bounds, false if it is not.
961b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
962c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
96350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2
964c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hasTransparentBounds(const  URegularExpression   *regexp,
965c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                                   UErrorCode           *status);
966c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
967c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
968c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
969c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Sets the transparency of region bounds for this URegularExpression.
970c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Invoking this function with an argument of TRUE will set matches to use transparent bounds.
971c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * If the boolean argument is FALSE, then opaque bounds will be used.
972c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
973c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Using transparent bounds, the boundaries of the matching region are transparent
974c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * to lookahead, lookbehind, and boundary matching constructs. Those constructs can
975c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * see text beyond the boundaries of the region while checking for a match.
976c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
977c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * With opaque bounds, no text outside of the matching region is visible to lookahead,
978c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * lookbehind, and boundary matching constructs.
979c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
980c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * By default, opaque bounds are used.
981c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
982c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param   regexp The compiled regular expression.
983c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param   b      TRUE for transparent bounds; FALSE for opaque bounds
984c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param   status A pointer to a UErrorCode to receive any errors.
985b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
986c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  **/
98750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
988c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_useTransparentBounds(URegularExpression   *regexp,
989c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                            UBool                b,
990c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                            UErrorCode           *status);
991c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
992c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
993c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
994c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Return true if this URegularExpression is using anchoring bounds.
995c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * By default, anchoring region bounds are used.
996c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
997c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param  regexp The compiled regular expression.
998c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param  status A pointer to a UErrorCode to receive any errors.
999c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @return TRUE if this matcher is using anchoring bounds.
1000b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
1001c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
100250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2
1003c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hasAnchoringBounds(const  URegularExpression   *regexp,
1004c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                                 UErrorCode           *status);
1005c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1006c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1007c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1008c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Set whether this URegularExpression is using Anchoring Bounds for its region.
1009c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * With anchoring bounds, pattern anchors such as ^ and $ will match at the start
1010c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * and end of the region.  Without Anchoring Bounds, anchors will only match at
1011c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * the positions they would in the complete text.
1012c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
1013c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Anchoring Bounds are the default for regions.
1014c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
1015c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
1016c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param b      TRUE if to enable anchoring bounds; FALSE to disable them.
1017c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
1018b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
1019c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
102050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
1021c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_useAnchoringBounds(URegularExpression   *regexp,
1022c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                          UBool                 b,
1023c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                          UErrorCode           *status);
1024c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1025c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1026c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Return TRUE if the most recent matching operation touched the
1027c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  end of the text being processed.  In this case, additional input text could
1028c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  change the results of that match.
1029c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
1030c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  @param regexp The compiled regular expression.
1031c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  @param status A pointer to a UErrorCode to receive any errors.
1032c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *  @return  TRUE if the most recent match hit the end of input
1033b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  *  @stable ICU 4.0
1034c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
103550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2
1036c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hitEnd(const  URegularExpression   *regexp,
1037c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                     UErrorCode           *status);
1038c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1039c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1040c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * Return TRUE the most recent match succeeded and additional input could cause
1041c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * it to fail. If this function returns false and a match was found, then more input
1042c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * might change the match but the match won't be lost. If a match was not found,
1043c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * then requireEnd has no meaning.
1044c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  *
1045c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param regexp The compiled regular expression.
1046c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @param status A pointer to a UErrorCode to receive any errors.
1047c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  * @return TRUE  if more input could cause the most recent match to no longer match.
1048b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru  * @stable ICU 4.0
1049c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru  */
105050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2
1051c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_requireEnd(const  URegularExpression   *regexp,
1052c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                         UErrorCode           *status);
1053c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1054c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1055c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1056c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1057b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1058b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1059b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    Replaces every substring of the input that matches the pattern
1060b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    with the given replacement string.  This is a convenience function that
1061b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    provides a complete find-and-replace-all operation.
1062b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1063b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    This method scans the input string looking for matches of the pattern.
1064b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    Input that is not part of any match is copied unchanged to the
1065b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    destination buffer.  Matched regions are replaced in the output
1066b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    buffer by the replacement string.   The replacement string may contain
1067b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    references to capture groups; these take the form of $1, $2, etc.
1068b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1069b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp             The compiled regular expression.
1070b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   replacementText    A string containing the replacement text.
1071b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   replacementLength  The length of the replacement string, or
1072b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                -1 if it is NUL terminated.
1073b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   destBuf            A (UChar *) buffer that will receive the result.
1074b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   destCapacity       The capacity of the destination buffer.
1075b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status             A reference to a UErrorCode to receive any errors.
1076b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @return                     The length of the string resulting from the find
1077b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                and replace operation.  In the event that the
1078b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                destination capacity is inadequate, the return value
1079b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                is still the full length of the untruncated string.
1080b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
1081b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
1082b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1083b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_replaceAll(URegularExpression    *regexp,
1084b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  const UChar           *replacementText,
1085b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t                replacementLength,
1086b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UChar                 *destBuf,
1087b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t                destCapacity,
1088b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode            *status);
1089b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
109050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    Replaces every substring of the input that matches the pattern
109250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    with the given replacement string.  This is a convenience function that
109350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    provides a complete find-and-replace-all operation.
109450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
109550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    This method scans the input string looking for matches of the pattern.
109650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    Input that is not part of any match is copied unchanged to the
109750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    destination buffer.  Matched regions are replaced in the output
109850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    buffer by the replacement string.   The replacement string may contain
109950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    references to capture groups; these take the form of $1, $2, etc.
110050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
110150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   regexp         The compiled regular expression.
110250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   replacement    A string containing the replacement text.
110350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   dest           A mutable UText that will receive the result.
110450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                             If NULL, a new UText will be created (which may not be mutable).
110550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   status         A reference to a UErrorCode to receive any errors.
110650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @return                 A UText containing the results of the find and replace.
110750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                             If a pre-allocated UText was provided, it will always be used and returned.
110850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
1109103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *    @stable ICU 4.6
111050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
111154dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
111250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_replaceAllUText(URegularExpression *regexp,
111350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                       UText              *replacement,
111450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                       UText              *dest,
111550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                       UErrorCode         *status);
1116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    Replaces the first substring of the input that matches the pattern
1119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    with the given replacement string.  This is a convenience function that
1120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    provides a complete find-and-replace operation.
1121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    This method scans the input string looking for a match of the pattern.
1123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    All input that is not part of the match is copied unchanged to the
1124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    destination buffer.  The matched region is replaced in the output
1125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    buffer by the replacement string.   The replacement string may contain
1126b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    references to capture groups; these take the form of $1, $2, etc.
1127b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1128b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   regexp             The compiled regular expression.
1129b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   replacementText    A string containing the replacement text.
1130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   replacementLength  The length of the replacement string, or
1131b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                -1 if it is NUL terminated.
1132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   destBuf            A (UChar *) buffer that will receive the result.
1133b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *    @param   destCapacity       The capacity of the destination buffer.
1134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @param   status             a reference to a UErrorCode to receive any errors.
1135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @return                     The length of the string resulting from the find
1136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                and replace operation.  In the event that the
1137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                destination capacity is inadequate, the return value
1138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                                is still the full length of the untruncated string.
1139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *    @stable ICU 3.0
1140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
1141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_replaceFirst(URegularExpression  *regexp,
1143b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    const UChar         *replacementText,
1144b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    int32_t              replacementLength,
1145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UChar               *destBuf,
1146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    int32_t              destCapacity,
1147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                    UErrorCode          *status);
1148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
114950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
115050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    Replaces the first substring of the input that matches the pattern
115150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    with the given replacement string.  This is a convenience function that
115250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    provides a complete find-and-replace operation.
115350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
115450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    This method scans the input string looking for a match of the pattern.
115550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    All input that is not part of the match is copied unchanged to the
115650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    destination buffer.  The matched region is replaced in the output
115750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    buffer by the replacement string.   The replacement string may contain
115850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    references to capture groups; these take the form of $1, $2, etc.
115950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
116050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   regexp         The compiled regular expression.
116150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   replacement    A string containing the replacement text.
116250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   dest           A mutable UText that will receive the result.
116350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                             If NULL, a new UText will be created (which may not be mutable).
116450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @param   status         A reference to a UErrorCode to receive any errors.
116550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *    @return                 A UText containing the results of the find and replace.
116650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                             If a pre-allocated UText was provided, it will always be used and returned.
116750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
1168103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *    @stable ICU 4.6
116950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
117054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
117150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_replaceFirstUText(URegularExpression *regexp,
117250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         UText              *replacement,
117350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         UText              *dest,
117450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         UErrorCode         *status);
117550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
1176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Implements a replace operation intended to be used as part of an
1178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   incremental find-and-replace.
1179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   <p>The input string, starting from the end of the previous match and ending at
1181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   the start of the current match, is appended to the destination string.  Then the
1182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   replacement string is appended to the output string,
1183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   including handling any substitutions of captured text.</p>
1184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   <p>A note on preflight computation of buffersize and error handling:
1186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   Calls to uregex_appendReplacement() and uregex_appendTail() are
1187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   designed to be chained, one after another, with the destination
1188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   buffer pointer and buffer capacity updated after each in preparation
1189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   to for the next.  If the destination buffer is exhausted partway through such a
1190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   sequence, a U_BUFFER_OVERFLOW_ERROR status will be returned.  Normal
1191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   ICU conventions are for a function to perform no action if it is
1192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   called with an error status, but for this one case, uregex_appendRepacement()
1193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   will operate normally so that buffer size computations will complete
1194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   correctly.
1195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   <p>For simple, prepackaged, non-incremental find-and-replace
1197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *      operations, see replaceFirst() or replaceAll().</p>
1198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   regexp      The regular expression object.
1200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   replacementText The string that will replace the matched portion of the
1201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        input string as it is copied to the destination buffer.
1202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        The replacement text may contain references ($1, for
1203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        example) to capture groups from the match.
1204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   replacementLength  The length of the replacement text string,
1205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        or -1 if the string is NUL terminated.
1206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   destBuf     The buffer into which the results of the
1207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        find-and-replace are placed.  On return, this pointer
1208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        will be updated to refer to the beginning of the
1209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        unused portion of buffer, leaving it in position for
1210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        a subsequent call to this function.
1211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   destCapacity The size of the output buffer,  On return, this
1212b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        parameter will be updated to reflect the space remaining
1213b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        unused in the output buffer.
1214b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   status      A reference to a UErrorCode to receive any errors.
1215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @return              The length of the result string.  In the event that
1216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        destCapacity is inadequate, the full length of the
1217b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        untruncated output string is returned.
1218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @stable ICU 3.0
1220b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
1222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_appendReplacement(URegularExpression    *regexp,
122450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         const UChar           *replacementText,
122550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         int32_t                replacementLength,
122650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         UChar                **destBuf,
122750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         int32_t               *destCapacity,
122850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                         UErrorCode            *status);
122950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
123050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
123150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   Implements a replace operation intended to be used as part of an
123250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   incremental find-and-replace.
123350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
123450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   <p>The input string, starting from the end of the previous match and ending at
123550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   the start of the current match, is appended to the destination string.  Then the
123650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   replacement string is appended to the output string,
123750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   including handling any substitutions of captured text.</p>
123850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
123950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   <p>For simple, prepackaged, non-incremental find-and-replace
124050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *      operations, see replaceFirst() or replaceAll().</p>
124150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
124250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   regexp      The regular expression object.
124350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   replacementText The string that will replace the matched portion of the
124450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                        input string as it is copied to the destination buffer.
124550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                        The replacement text may contain references ($1, for
124650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                        example) to capture groups from the match.
124750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   dest        A mutable UText that will receive the result. Must not be NULL.
124850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   status      A reference to a UErrorCode to receive any errors.
124950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
1250103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
125150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
125254dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
125350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_appendReplacementUText(URegularExpression    *regexp,
125450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                              UText                 *replacementText,
125550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                              UText                 *dest,
125650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                              UErrorCode            *status);
1257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/**
1259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * As the final step in a find-and-replace operation, append the remainder
1260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * of the input string, starting at the position following the last match,
1261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  * to the destination string. <code>uregex_appendTail()</code> is intended
1262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  to be invoked after one or more invocations of the
1263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *  <code>uregex_appendReplacement()</code> function.
1264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1265b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   regexp      The regular expression object.  This is needed to
1266b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        obtain the input string and with the position
1267b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        of the last match within it.
1268b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   destBuf     The buffer in which the results of the
1269b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        find-and-replace are placed.  On return, the pointer
1270b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        will be updated to refer to the beginning of the
1271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        unused portion of buffer.
1272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   destCapacity The size of the output buffer,  On return, this
1273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        value will be updated to reflect the space remaining
1274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        unused in the output buffer.
1275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @param   status      A reference to a UErrorCode to receive any errors.
1276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @return              The length of the result string.  In the event that
1277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        destCapacity is inadequate, the full length of the
1278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *                        untruncated output string is returned.
1279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *
1280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  *   @stable ICU 3.0
1281b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru  */
1282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1283b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_appendTail(URegularExpression    *regexp,
1284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UChar                **destBuf,
1285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t               *destCapacity,
1286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode            *status);
1287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
128850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/**
128950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * As the final step in a find-and-replace operation, append the remainder
129050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * of the input string, starting at the position following the last match,
129150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  * to the destination string. <code>uregex_appendTailUText()</code> is intended
129250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  to be invoked after one or more invocations of the
129350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *  <code>uregex_appendReplacementUText()</code> function.
129450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
129550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   regexp      The regular expression object.  This is needed to
129650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                        obtain the input string and with the position
129750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *                        of the last match within it.
129850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @param   dest        A mutable UText that will receive the result. Must not be NULL.
1299b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
1300b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *   @param status        Error code
1301b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho  *
130250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *   @return              The destination UText.
130350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  *
1304103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius  *   @stable ICU 4.6
130550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  */
130654dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2
130750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_appendTailUText(URegularExpression    *regexp,
130827f654740f2a26ad62a5c155af9199af9e69b889claireho                       UText                 *dest,
130927f654740f2a26ad62a5c155af9199af9e69b889claireho                       UErrorCode            *status);
1310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
1311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /**
1312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   * Split a string into fields.  Somewhat like split() from Perl.
1313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *  The pattern matches identify delimiters that separate the input
1314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *  into fields.  The input data between the matches becomes the
1315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *  fields themselves.
1316b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *
1317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *  Each of the fields is copied from the input string to the destination
131850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *  buffer, and NUL terminated.  The position of each field within
1319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *  the destination buffer is returned in the destFields array.
1320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *
1321b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  If the delimiter pattern includes capture groups, the captured text will
1322b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  also appear in the destination array of output strings, interspersed
1323b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  with the fields.  This is similar to Perl, but differs from Java,
1324b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  which ignores the presence of capture groups in the pattern.
1325b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *
1326b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  Trailing empty fields will always be returned, assuming sufficient
1327b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  destination capacity.  This differs from the default behavior for Java
1328b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  and Perl where trailing empty fields are not returned.
1329b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *
1330b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  The number of strings produced by the split operation is returned.
1331b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  This count includes the strings from capture groups in the delimiter pattern.
1332b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho   *  This behavior differs from Java, which ignores capture groups.
1333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *
1334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   regexp      The compiled regular expression.
1335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   destBuf     A (UChar *) buffer to receive the fields that
1336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         are extracted from the input string. These
1337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         field pointers will refer to positions within the
1338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         destination buffer supplied by the caller.  Any
1339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         extra positions within the destFields array will be
1340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         set to NULL.
1341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   destCapacity The capacity of the destBuf.
1342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   requiredCapacity  The actual capacity required of the destBuf.
1343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         If destCapacity is too small, requiredCapacity will return
1344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         the total capacity required to hold all of the output, and
1345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         a U_BUFFER_OVERFLOW_ERROR will be returned.
1346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   destFields  An array to be filled with the position of each
1347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                         of the extracted fields within destBuf.
1348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *    @param   destFieldsCapacity  The number of elements in the destFields array.
1349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                If the number of fields found is less than destFieldsCapacity,
1350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                the extra destFields elements are set to zero.
1351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                If destFieldsCapacity is too small, the trailing part of the
1352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                input, including any field delimiters, is treated as if it
1353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                were the last field - it is copied to the destBuf, and
1354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                its position is in the destBuf is stored in the last element
1355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                of destFields.  This behavior mimics that of Perl.  It is not
1356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                an error condition, and no error status is returned when all destField
1357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   *                positions are used.
1358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   * @param status  A reference to a UErrorCode to receive any errors.
1359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   * @return        The number of fields into which the input string was split.
1360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   * @stable ICU 3.0
1361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru   */
1362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2
1363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_split(   URegularExpression      *regexp,
1364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UChar                 *destBuf,
1365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t                destCapacity,
1366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t               *requiredCapacity,
1367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UChar                 *destFields[],
1368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  int32_t                destFieldsCapacity,
1369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru                  UErrorCode            *status);
1370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru
137150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho  /**
137250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * Split a string into fields.  Somewhat like split() from Perl.
137350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * The pattern matches identify delimiters that separate the input
137450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *  into fields.  The input data between the matches becomes the
137550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *  fields themselves.
137650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * <p>
137750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * The behavior of this function is not very closely aligned with uregex_split();
137850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * instead, it is based on (and implemented directly on top of) the C++ split method.
137950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *
138050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * @param regexp  The compiled regular expression.
138150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * @param destFields    An array of mutable UText structs to receive the results of the split.
138250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                If a field is NULL, a new UText is allocated to contain the results for
138350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                that field. This new UText is not guaranteed to be mutable.
138450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * @param destFieldsCapacity  The number of elements in the destination array.
138550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                If the number of fields found is less than destCapacity, the
138650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                extra strings in the destination array are not altered.
138750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                If the number of destination strings is less than the number
138850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                of fields, the trailing part of the input string, including any
138950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                field delimiters, is placed in the last destination string.
139050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                This behavior mimics that of Perl.  It is not  an error condition, and no
139150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *                error status is returned when all destField positions are used.
139250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * @param status  A reference to a UErrorCode to receive any errors.
139350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   * @return        The number of fields into which the input string was split.
139450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   *
1395103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius   * @stable ICU 4.6
139650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho   */
139754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2
139850294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_splitUText(URegularExpression    *regexp,
139950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                  UText                 *destFields[],
140050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                  int32_t                destFieldsCapacity,
140150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho                  UErrorCode            *status);
140250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho
1403c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1404c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Set a processing time limit for match operations with this URegularExpression.
1405c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1406c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Some patterns, when matching certain strings, can run in exponential time.
1407c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * For practical purposes, the match operation may appear to be in an
1408c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * infinite loop.
1409c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * When a limit is set a match operation will fail with an error if the
1410c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * limit is exceeded.
1411c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1412c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * The units of the limit are steps of the match engine.
1413c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Correspondence with actual processor time will depend on the speed
1414c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * of the processor and the details of the specific pattern, but will
1415c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * typically be on the order of milliseconds.
1416c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1417c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * By default, the matching time is not limited.
1418c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1419c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1420c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   regexp      The compiled regular expression.
1421c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   limit       The limit value, or 0 for no limit.
1422c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   status      A reference to a UErrorCode to receive any errors.
1423b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1424c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
142550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
1426c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setTimeLimit(URegularExpression      *regexp,
1427c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                    int32_t                  limit,
1428c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                    UErrorCode              *status);
1429c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1430c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1431c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the time limit for for matches with this URegularExpression.
1432c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * A return value of zero indicates that there is no limit.
1433c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1434c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   regexp      The compiled regular expression.
1435c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   status      A reference to a UErrorCode to receive any errors.
1436c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return the maximum allowed time for a match, in units of processing steps.
1437b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1438c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
143950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2
1440c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getTimeLimit(const URegularExpression      *regexp,
1441c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                          UErrorCode              *status);
1442c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1443c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1444b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Set the amount of heap storage available for use by the match backtracking stack.
1445c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1446c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * ICU uses a backtracking regular expression engine, with the backtrack stack
1447c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * maintained on the heap.  This function sets the limit to the amount of memory
1448c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * that can be used  for this purpose.  A backtracking stack overflow will
1449c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * result in an error from the match operation that caused it.
1450c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1451c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * A limit is desirable because a malicious or poorly designed pattern can use
1452c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * excessive memory, potentially crashing the process.  A limit is enabled
1453c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * by default.
1454c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p>
1455c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   regexp      The compiled regular expression.
1456c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   limit       The maximum size, in bytes, of the matching backtrack stack.
145759d709d503bab6e2b61931737e662dd293b40578ccornelius *                      A value of zero means no limit.
145859d709d503bab6e2b61931737e662dd293b40578ccornelius *                      The limit must be greater than or equal to zero.
1459c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   status      A reference to a UErrorCode to receive any errors.
1460c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1461b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1462c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
146350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
1464c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setStackLimit(URegularExpression      *regexp,
1465c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                     int32_t                  limit,
1466c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                     UErrorCode              *status);
1467c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1468c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1469c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the size of the heap storage available for use by the back tracking stack.
1470c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1471c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return  the maximum backtracking stack size, in bytes, or zero if the
1472c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *          stack size is unlimited.
1473b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1474c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
147550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2
1476c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getStackLimit(const URegularExpression      *regexp,
1477c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                           UErrorCode              *status);
1478c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1479c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1480c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1481c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Function pointer for a regular expression matching callback function.
1482c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * When set, a callback function will be called periodically during matching
1483c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * operations.  If the call back function returns FALSE, the matching
1484c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * operation will be terminated early.
1485c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1486c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Note:  the callback function must not call other functions on this
1487c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *        URegularExpression.
1488c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1489c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param context  context pointer.  The callback function will be invoked
1490c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                 with the context specified at the time that
1491c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                 uregex_setMatchCallback() is called.
1492c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param steps    the accumulated processing time, in match steps,
1493c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                 for this matching operation.
1494c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return         TRUE to continue the matching operation.
1495c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                 FALSE to terminate the matching operation.
1496b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1497c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
1498c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste QueruU_CDECL_BEGIN
1499c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Querutypedef UBool U_CALLCONV URegexMatchCallback (
1500c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                   const void *context,
1501c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                   int32_t     steps);
1502c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste QueruU_CDECL_END
1503c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1504c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1505c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Set a callback function for this URegularExpression.
1506c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * During matching operations the function will be called periodically,
1507c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * giving the application the opportunity to terminate a long-running
1508c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * match.
1509c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1510c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   regexp      The compiled regular expression.
1511c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   callback    A pointer to the user-supplied callback function.
1512c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   context     User context pointer.  The value supplied at the
1513c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                      time the callback function is set will be saved
1514c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                      and passed to the callback each time that it is called.
1515c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   status      A reference to a UErrorCode to receive any errors.
1516b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1517c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
151850294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
1519c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setMatchCallback(URegularExpression      *regexp,
1520c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        URegexMatchCallback     *callback,
1521c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        const void              *context,
1522c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        UErrorCode              *status);
1523c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1524c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1525c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/**
1526c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *  Get the callback function for this URegularExpression.
1527c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *
1528c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   regexp      The compiled regular expression.
1529b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param   callback    Out parameter, receives a pointer to the user-supplied
1530c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                      callback function.
1531c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   context     Out parameter, receives the user context pointer that
1532c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru *                      was set when uregex_setMatchCallback() was called.
1533c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param   status      A reference to a UErrorCode to receive any errors.
1534b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0
1535c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */
153650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2
1537c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getMatchCallback(const URegularExpression    *regexp,
1538c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        URegexMatchCallback        **callback,
1539c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        const void                 **context,
1540c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru                        UErrorCode                  *status);
1541c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
154227f654740f2a26ad62a5c155af9199af9e69b889claireho/**
154327f654740f2a26ad62a5c155af9199af9e69b889claireho * Function pointer for a regular expression find callback function.
154427f654740f2a26ad62a5c155af9199af9e69b889claireho *
154527f654740f2a26ad62a5c155af9199af9e69b889claireho * When set, a callback function will be called during a find operation
154627f654740f2a26ad62a5c155af9199af9e69b889claireho * and for operations that depend on find, such as findNext, split and some replace
154727f654740f2a26ad62a5c155af9199af9e69b889claireho * operations like replaceFirst.
154827f654740f2a26ad62a5c155af9199af9e69b889claireho * The callback will usually be called after each attempt at a match, but this is not a
154927f654740f2a26ad62a5c155af9199af9e69b889claireho * guarantee that the callback will be invoked at each character.  For finds where the
155027f654740f2a26ad62a5c155af9199af9e69b889claireho * match engine is invoked at each character, this may be close to true, but less likely
155127f654740f2a26ad62a5c155af9199af9e69b889claireho * for more optimized loops where the pattern is known to only start, and the match
155227f654740f2a26ad62a5c155af9199af9e69b889claireho * engine invoked, at certain characters.
155327f654740f2a26ad62a5c155af9199af9e69b889claireho * When invoked, this callback will specify the index at which a match operation is about
155427f654740f2a26ad62a5c155af9199af9e69b889claireho * to be attempted, giving the application the opportunity to terminate a long-running
155527f654740f2a26ad62a5c155af9199af9e69b889claireho * find operation.
155627f654740f2a26ad62a5c155af9199af9e69b889claireho *
155727f654740f2a26ad62a5c155af9199af9e69b889claireho * If the call back function returns FALSE, the find operation will be terminated early.
155827f654740f2a26ad62a5c155af9199af9e69b889claireho *
155927f654740f2a26ad62a5c155af9199af9e69b889claireho * Note:  the callback function must not call other functions on this
156027f654740f2a26ad62a5c155af9199af9e69b889claireho *        URegularExpression
156127f654740f2a26ad62a5c155af9199af9e69b889claireho *
156227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param context  context pointer.  The callback function will be invoked
156327f654740f2a26ad62a5c155af9199af9e69b889claireho *                 with the context specified at the time that
156427f654740f2a26ad62a5c155af9199af9e69b889claireho *                 uregex_setFindProgressCallback() is called.
156527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param matchIndex  the next index at which a match attempt will be attempted for this
156627f654740f2a26ad62a5c155af9199af9e69b889claireho *                 find operation.  If this callback interrupts the search, this is the
156727f654740f2a26ad62a5c155af9199af9e69b889claireho *                 index at which a find/findNext operation may be re-initiated.
156827f654740f2a26ad62a5c155af9199af9e69b889claireho * @return         TRUE to continue the matching operation.
156927f654740f2a26ad62a5c155af9199af9e69b889claireho *                 FALSE to terminate the matching operation.
1570103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
157127f654740f2a26ad62a5c155af9199af9e69b889claireho */
157227f654740f2a26ad62a5c155af9199af9e69b889clairehoU_CDECL_BEGIN
157327f654740f2a26ad62a5c155af9199af9e69b889clairehotypedef UBool U_CALLCONV URegexFindProgressCallback (
157427f654740f2a26ad62a5c155af9199af9e69b889claireho                   const void *context,
157527f654740f2a26ad62a5c155af9199af9e69b889claireho                   int64_t     matchIndex);
157627f654740f2a26ad62a5c155af9199af9e69b889clairehoU_CDECL_END
157727f654740f2a26ad62a5c155af9199af9e69b889claireho
1578103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
157927f654740f2a26ad62a5c155af9199af9e69b889claireho/**
158027f654740f2a26ad62a5c155af9199af9e69b889claireho *  Set the find progress callback function for this URegularExpression.
158127f654740f2a26ad62a5c155af9199af9e69b889claireho *
158227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   regexp      The compiled regular expression.
158327f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   callback    A pointer to the user-supplied callback function.
158427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   context     User context pointer.  The value supplied at the
158527f654740f2a26ad62a5c155af9199af9e69b889claireho *                      time the callback function is set will be saved
158627f654740f2a26ad62a5c155af9199af9e69b889claireho *                      and passed to the callback each time that it is called.
158727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   status      A reference to a UErrorCode to receive any errors.
1588103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
158927f654740f2a26ad62a5c155af9199af9e69b889claireho */
159054dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
159127f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setFindProgressCallback(URegularExpression              *regexp,
159227f654740f2a26ad62a5c155af9199af9e69b889claireho                                URegexFindProgressCallback      *callback,
159327f654740f2a26ad62a5c155af9199af9e69b889claireho                                const void                      *context,
159427f654740f2a26ad62a5c155af9199af9e69b889claireho                                UErrorCode                      *status);
159527f654740f2a26ad62a5c155af9199af9e69b889claireho
159627f654740f2a26ad62a5c155af9199af9e69b889claireho/**
159727f654740f2a26ad62a5c155af9199af9e69b889claireho *  Get the find progress callback function for this URegularExpression.
159827f654740f2a26ad62a5c155af9199af9e69b889claireho *
159927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   regexp      The compiled regular expression.
1600b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param   callback    Out parameter, receives a pointer to the user-supplied
160127f654740f2a26ad62a5c155af9199af9e69b889claireho *                      callback function.
160227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   context     Out parameter, receives the user context pointer that
160327f654740f2a26ad62a5c155af9199af9e69b889claireho *                      was set when uregex_setFindProgressCallback() was called.
160427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param   status      A reference to a UErrorCode to receive any errors.
1605103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6
160627f654740f2a26ad62a5c155af9199af9e69b889claireho */
160754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2
160827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_getFindProgressCallback(const URegularExpression          *regexp,
160927f654740f2a26ad62a5c155af9199af9e69b889claireho                                URegexFindProgressCallback        **callback,
161027f654740f2a26ad62a5c155af9199af9e69b889claireho                                const void                        **context,
161127f654740f2a26ad62a5c155af9199af9e69b889claireho                                UErrorCode                        *status);
1612c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru
1613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif   /*  !UCONFIG_NO_REGULAR_EXPRESSIONS  */
1614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif   /*  UREGEX_H  */
1615