1b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 2b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 38393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius* Copyright (C) 2004-2013, 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 610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** Extract the string for the specified matching expression or subexpression. 611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #0 is the complete string of matched text. 612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #1 is the text matched by the first set of capturing parentheses. 613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param groupNum The capture group to extract. Group 0 is the complete 616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * match. The value of this parameter must be 617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * less than or equal to the number of capture groups in 618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the pattern. 619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Buffer to receive the matching string data 620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity Capacity of the dest buffer. 621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return Length of matching data, 623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or -1 if no applicable match. 624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_group(URegularExpression *regexp, 628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t groupNum, 629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *dest, 630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 63327f654740f2a26ad62a5c155af9199af9e69b889claireho/** Returns a shallow immutable clone of the entire input string. The returned UText current native index 63427f654740f2a26ad62a5c155af9199af9e69b889claireho * is set to the beginning of the requested capture group. The capture group length is also 63527f654740f2a26ad62a5c155af9199af9e69b889claireho * returned via groupLength. 63627f654740f2a26ad62a5c155af9199af9e69b889claireho * Group #0 is the complete string of matched text. 63727f654740f2a26ad62a5c155af9199af9e69b889claireho * Group #1 is the text matched by the first set of capturing parentheses. 63827f654740f2a26ad62a5c155af9199af9e69b889claireho * 63927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param regexp The compiled regular expression. 64027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param groupNum The capture group to extract. Group 0 is the complete 64127f654740f2a26ad62a5c155af9199af9e69b889claireho * match. The value of this parameter must be 64227f654740f2a26ad62a5c155af9199af9e69b889claireho * less than or equal to the number of capture groups in 64327f654740f2a26ad62a5c155af9199af9e69b889claireho * the pattern. 64427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param dest A mutable UText in which to store the current input. 64527f654740f2a26ad62a5c155af9199af9e69b889claireho * If NULL, a new UText will be created as an immutable shallow clone 64627f654740f2a26ad62a5c155af9199af9e69b889claireho * of the entire input string. 64727f654740f2a26ad62a5c155af9199af9e69b889claireho * @param groupLength The group length of the desired capture group. 64827f654740f2a26ad62a5c155af9199af9e69b889claireho * @param status A reference to a UErrorCode to receive any errors. 64927f654740f2a26ad62a5c155af9199af9e69b889claireho * @return The subject text currently associated with this regular expression. 65027f654740f2a26ad62a5c155af9199af9e69b889claireho * If a pre-allocated UText was provided, it will always be used and returned. 65127f654740f2a26ad62a5c155af9199af9e69b889claireho 65227f654740f2a26ad62a5c155af9199af9e69b889claireho * 653103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 65427f654740f2a26ad62a5c155af9199af9e69b889claireho */ 65554dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2 65627f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_groupUText(URegularExpression *regexp, 65727f654740f2a26ad62a5c155af9199af9e69b889claireho int32_t groupNum, 65827f654740f2a26ad62a5c155af9199af9e69b889claireho UText *dest, 65927f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t *groupLength, 66027f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 66127f654740f2a26ad62a5c155af9199af9e69b889claireho 662103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API 66350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** Extract the string for the specified matching expression or subexpression. 66450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Group #0 is the complete string of matched text. 66550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Group #1 is the text matched by the first set of capturing parentheses. 66650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 66750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The compiled regular expression. 66850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param groupNum The capture group to extract. Group 0 is the complete 66950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * match. The value of this parameter must be 67050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * less than or equal to the number of capture groups in 67150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * the pattern. 67250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest Mutable UText to receive the matching string data. 67350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If NULL, a new UText will be created (which may not be mutable). 67450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status A reference to a UErrorCode to receive any errors. 67550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return The matching string data. If a pre-allocated UText was provided, 67650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * it will always be used and returned. 67750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 67850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @internal ICU 4.4 technology preview 67950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 68050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_INTERNAL UText * U_EXPORT2 68127f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_groupUTextDeep(URegularExpression *regexp, 68250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t groupNum, 68350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *dest, 68450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 685103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 68650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the index in the input string of the start of the text matched by the 689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * specified capture group during the previous match operation. Return -1 if 690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the capture group was not part of the last match. 691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #0 refers to the complete range of matched text. 692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #1 refers to the text matched by the first set of capturing parentheses. 693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param groupNum The capture group number 696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 69727f654740f2a26ad62a5c155af9199af9e69b889claireho * @return the starting (native) position in the input of the text matched 698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * by the specified group. 699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 702b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_start(URegularExpression *regexp, 703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t groupNum, 704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 70727f654740f2a26ad62a5c155af9199af9e69b889claireho * 64bit version of uregex_start. 708b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Returns the index in the input string of the start of the text matched by the 709b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * specified capture group during the previous match operation. Return -1 if 710b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * the capture group was not part of the last match. 711b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Group #0 refers to the complete range of matched text. 712b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Group #1 refers to the text matched by the first set of capturing parentheses. 713b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 714b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 715b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param groupNum The capture group number 716b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A reference to a UErrorCode to receive any errors. 717b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return the starting (native) position in the input of the text matched 718b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * by the specified group. 719103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 72027f654740f2a26ad62a5c155af9199af9e69b889claireho */ 72154dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2 72227f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_start64(URegularExpression *regexp, 72327f654740f2a26ad62a5c155af9199af9e69b889claireho int32_t groupNum, 72427f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 72527f654740f2a26ad62a5c155af9199af9e69b889claireho 72627f654740f2a26ad62a5c155af9199af9e69b889claireho/** 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the index in the input string of the position following the end 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * of the text matched by the specified capture group. 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Return -1 if the capture group was not part of the last match. 730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #0 refers to the complete range of matched text. 731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Group #1 refers to the text matched by the first set of capturing parentheses. 732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param groupNum The capture group number 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 73627f654740f2a26ad62a5c155af9199af9e69b889claireho * @return the (native) index of the position following the last matched character. 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_end(URegularExpression *regexp, 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t groupNum, 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 74527f654740f2a26ad62a5c155af9199af9e69b889claireho * 64bit version of uregex_end. 746b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Returns the index in the input string of the position following the end 747b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * of the text matched by the specified capture group. 748b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Return -1 if the capture group was not part of the last match. 749b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Group #0 refers to the complete range of matched text. 750b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Group #1 refers to the text matched by the first set of capturing parentheses. 751b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 752b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 753b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param groupNum The capture group number 754b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A reference to a UErrorCode to receive any errors. 755b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return the (native) index of the position following the last matched character. 756103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 75727f654740f2a26ad62a5c155af9199af9e69b889claireho */ 75854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2 75927f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_end64(URegularExpression *regexp, 76027f654740f2a26ad62a5c155af9199af9e69b889claireho int32_t groupNum, 76127f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 76227f654740f2a26ad62a5c155af9199af9e69b889claireho 76327f654740f2a26ad62a5c155af9199af9e69b889claireho/** 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Reset any saved state from the previous match. Has the effect of 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * causing uregex_findNext to begin at the specified index, and causing 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * uregex_start(), uregex_end() and uregex_group() to return an error 767c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * indicating that there is no match information available. Clears any 768c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * match region that may have been set. 769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 77127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param index The position (native) in the text at which a 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * uregex_findNext() should begin searching. 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_reset(URegularExpression *regexp, 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t index, 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 780103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 78127f654740f2a26ad62a5c155af9199af9e69b889claireho/** 782b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 64bit version of uregex_reset. 783b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Reset any saved state from the previous match. Has the effect of 784b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * causing uregex_findNext to begin at the specified index, and causing 785b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * uregex_start(), uregex_end() and uregex_group() to return an error 786b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * indicating that there is no match information available. Clears any 787b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * match region that may have been set. 788b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 789b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 790b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param index The position (native) in the text at which a 791b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * uregex_findNext() should begin searching. 792b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A reference to a UErrorCode to receive any errors. 793103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 79427f654740f2a26ad62a5c155af9199af9e69b889claireho */ 79554dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 79627f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_reset64(URegularExpression *regexp, 79727f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t index, 79827f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 79927f654740f2a26ad62a5c155af9199af9e69b889claireho 800b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho/** 801b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Sets the limits of the matching region for this URegularExpression. 802c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * The region is the part of the input string that will be considered when matching. 803c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Invoking this method resets any saved state from the previous match, 804c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * then sets the region to start at the index specified by the start parameter 805c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * and end at the index specified by the end parameter. 806c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 807c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Depending on the transparency and anchoring being used (see useTransparentBounds 808c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * and useAnchoringBounds), certain constructs such as anchors may behave differently 809c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * at or around the boundaries of the region 810c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 811c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * The function will fail if start is greater than limit, or if either index 812c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * is less than zero or greater than the length of the string being matched. 813c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 814c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 81527f654740f2a26ad62a5c155af9199af9e69b889claireho * @param regionStart The (native) index to begin searches at. 81627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param regionLimit The (native) index to end searches at (exclusive). 817c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 818b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 819c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 82050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 821c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setRegion(URegularExpression *regexp, 822c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t regionStart, 823c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t regionLimit, 824c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 825c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 826c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 827b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 64bit version of uregex_setRegion. 828b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Sets the limits of the matching region for this URegularExpression. 829b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The region is the part of the input string that will be considered when matching. 830b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Invoking this method resets any saved state from the previous match, 831b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * then sets the region to start at the index specified by the start parameter 832b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * and end at the index specified by the end parameter. 833b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 834b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Depending on the transparency and anchoring being used (see useTransparentBounds 835b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * and useAnchoringBounds), certain constructs such as anchors may behave differently 836b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * at or around the boundaries of the region 837b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 838b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The function will fail if start is greater than limit, or if either index 839b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * is less than zero or greater than the length of the string being matched. 840b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 841b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 842b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regionStart The (native) index to begin searches at. 843b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regionLimit The (native) index to end searches at (exclusive). 844b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A pointer to a UErrorCode to receive any errors. 845103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 84627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 84754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 84827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setRegion64(URegularExpression *regexp, 84927f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t regionStart, 85027f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t regionLimit, 85127f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 85227f654740f2a26ad62a5c155af9199af9e69b889claireho 85327f654740f2a26ad62a5c155af9199af9e69b889claireho/** 854b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Set the matching region and the starting index for subsequent matches 855b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * in a single operation. 856b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * This is useful because the usual function for setting the starting 857b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * index, urgex_reset(), also resets any region limits. 858b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 859b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 860b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regionStart The (native) index to begin searches at. 861b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regionLimit The (native) index to end searches at (exclusive). 862b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param startIndex The index in the input text at which the next 863b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * match operation should begin. 864b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A pointer to a UErrorCode to receive any errors. 865103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 86627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 86754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 86827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setRegionAndStart(URegularExpression *regexp, 86927f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t regionStart, 87027f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t regionLimit, 87127f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t startIndex, 87227f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 87327f654740f2a26ad62a5c155af9199af9e69b889claireho 87427f654740f2a26ad62a5c155af9199af9e69b889claireho/** 875c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Reports the start index of the matching region. Any matches found are limited to 876c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * to the region bounded by regionStart (inclusive) and regionEnd (exclusive). 877c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 878c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 879c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 88027f654740f2a26ad62a5c155af9199af9e69b889claireho * @return The starting (native) index of this matcher's region. 881b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 882c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 88350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 884c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_regionStart(const URegularExpression *regexp, 885c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 886c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 88727f654740f2a26ad62a5c155af9199af9e69b889claireho/** 888b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 64bit version of uregex_regionStart. 889b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Reports the start index of the matching region. Any matches found are limited to 890b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * to the region bounded by regionStart (inclusive) and regionEnd (exclusive). 891b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 892b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 893b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A pointer to a UErrorCode to receive any errors. 894b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The starting (native) index of this matcher's region. 895103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 89627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 89754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2 89827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_regionStart64(const URegularExpression *regexp, 89927f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 900c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 901c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 902c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Reports the end index (exclusive) of the matching region for this URegularExpression. 903c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Any matches found are limited to to the region bounded by regionStart (inclusive) 904c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * and regionEnd (exclusive). 905c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 906c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 907c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 90827f654740f2a26ad62a5c155af9199af9e69b889claireho * @return The ending point (native) of this matcher's region. 909b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 910c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 91150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 912c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_regionEnd(const URegularExpression *regexp, 913c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 914c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 915c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 916b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 64bit version of uregex_regionEnd. 917b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Reports the end index (exclusive) of the matching region for this URegularExpression. 918b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Any matches found are limited to to the region bounded by regionStart (inclusive) 919b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * and regionEnd (exclusive). 920b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 921b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param regexp The compiled regular expression. 922b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status A pointer to a UErrorCode to receive any errors. 923b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @return The ending point (native) of this matcher's region. 924103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 92527f654740f2a26ad62a5c155af9199af9e69b889claireho */ 92654dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int64_t U_EXPORT2 92727f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_regionEnd64(const URegularExpression *regexp, 92827f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 92927f654740f2a26ad62a5c155af9199af9e69b889claireho 93027f654740f2a26ad62a5c155af9199af9e69b889claireho/** 931c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Queries the transparency of region bounds for this URegularExpression. 932c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * See useTransparentBounds for a description of transparent and opaque bounds. 933c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * By default, matching boundaries are opaque. 934c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 935c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 936c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 937c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return TRUE if this matcher is using opaque bounds, false if it is not. 938b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 939c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 94050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2 941c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hasTransparentBounds(const URegularExpression *regexp, 942c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 943c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 944c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 945c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 946c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Sets the transparency of region bounds for this URegularExpression. 947c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Invoking this function with an argument of TRUE will set matches to use transparent bounds. 948c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * If the boolean argument is FALSE, then opaque bounds will be used. 949c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 950c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Using transparent bounds, the boundaries of the matching region are transparent 951c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * to lookahead, lookbehind, and boundary matching constructs. Those constructs can 952c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * see text beyond the boundaries of the region while checking for a match. 953c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 954c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * With opaque bounds, no text outside of the matching region is visible to lookahead, 955c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * lookbehind, and boundary matching constructs. 956c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 957c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * By default, opaque bounds are used. 958c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 959c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 960c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param b TRUE for transparent bounds; FALSE for opaque bounds 961c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 962b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 963c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru **/ 96450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 965c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_useTransparentBounds(URegularExpression *regexp, 966c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UBool b, 967c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 968c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 969c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 970c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 971c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Return true if this URegularExpression is using anchoring bounds. 972c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * By default, anchoring region bounds are used. 973c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 974c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 975c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 976c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return TRUE if this matcher is using anchoring bounds. 977b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 978c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 97950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2 980c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hasAnchoringBounds(const URegularExpression *regexp, 981c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 982c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 983c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 984c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 985c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Set whether this URegularExpression is using Anchoring Bounds for its region. 986c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * With anchoring bounds, pattern anchors such as ^ and $ will match at the start 987c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * and end of the region. Without Anchoring Bounds, anchors will only match at 988c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * the positions they would in the complete text. 989c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 990c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Anchoring Bounds are the default for regions. 991c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 992c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 993c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param b TRUE if to enable anchoring bounds; FALSE to disable them. 994c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 995b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 996c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 99750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 998c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_useAnchoringBounds(URegularExpression *regexp, 999c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UBool b, 1000c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1001c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1002c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1003c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Return TRUE if the most recent matching operation touched the 1004c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * end of the text being processed. In this case, additional input text could 1005c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * change the results of that match. 1006c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1007c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1008c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 1009c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return TRUE if the most recent match hit the end of input 1010b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1011c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 101250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2 1013c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_hitEnd(const URegularExpression *regexp, 1014c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1015c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1016c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1017c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Return TRUE the most recent match succeeded and additional input could cause 1018c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * it to fail. If this function returns false and a match was found, then more input 1019c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * might change the match but the match won't be lost. If a match was not found, 1020c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * then requireEnd has no meaning. 1021c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1022c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1023c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A pointer to a UErrorCode to receive any errors. 1024c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return TRUE if more input could cause the most recent match to no longer match. 1025b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1026c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 102750294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE UBool U_EXPORT2 1028c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_requireEnd(const URegularExpression *regexp, 1029c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1030c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1031c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1032c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1033c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1034b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1035b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1036b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Replaces every substring of the input that matches the pattern 1037b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with the given replacement string. This is a convenience function that 1038b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * provides a complete find-and-replace-all operation. 1039b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1040b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This method scans the input string looking for matches of the pattern. 1041b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Input that is not part of any match is copied unchanged to the 1042b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destination buffer. Matched regions are replaced in the output 1043b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer by the replacement string. The replacement string may contain 1044b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * references to capture groups; these take the form of $1, $2, etc. 1045b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1046b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 1047b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementText A string containing the replacement text. 1048b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementLength The length of the replacement string, or 1049b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * -1 if it is NUL terminated. 1050b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destBuf A (UChar *) buffer that will receive the result. 1051b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The capacity of the destination buffer. 1052b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1053b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the string resulting from the find 1054b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and replace operation. In the event that the 1055b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destination capacity is inadequate, the return value 1056b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is still the full length of the untruncated string. 1057b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 1058b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1059b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1060b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_replaceAll(URegularExpression *regexp, 1061b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *replacementText, 1062b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t replacementLength, 1063b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *destBuf, 1064b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1065b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 1066b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 106750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 106850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Replaces every substring of the input that matches the pattern 106950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * with the given replacement string. This is a convenience function that 107050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * provides a complete find-and-replace-all operation. 107150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 107250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * This method scans the input string looking for matches of the pattern. 107350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Input that is not part of any match is copied unchanged to the 107450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * destination buffer. Matched regions are replaced in the output 107550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * buffer by the replacement string. The replacement string may contain 107650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * references to capture groups; these take the form of $1, $2, etc. 107750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 107850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The compiled regular expression. 107950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param replacement A string containing the replacement text. 108050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A mutable UText that will receive the result. 108150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If NULL, a new UText will be created (which may not be mutable). 108250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status A reference to a UErrorCode to receive any errors. 108350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return A UText containing the results of the find and replace. 108450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If a pre-allocated UText was provided, it will always be used and returned. 108550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 1086103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 108750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 108854dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2 108950294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_replaceAllUText(URegularExpression *regexp, 109050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *replacement, 109150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *dest, 109250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 1093b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1094b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1095b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Replaces the first substring of the input that matches the pattern 1096b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * with the given replacement string. This is a convenience function that 1097b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * provides a complete find-and-replace operation. 1098b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1099b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This method scans the input string looking for a match of the pattern. 1100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * All input that is not part of the match is copied unchanged to the 1101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destination buffer. The matched region is replaced in the output 1102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer by the replacement string. The replacement string may contain 1103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * references to capture groups; these take the form of $1, $2, etc. 1104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 1106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementText A string containing the replacement text. 1107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementLength The length of the replacement string, or 1108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * -1 if it is NUL terminated. 1109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destBuf A (UChar *) buffer that will receive the result. 1110b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param destCapacity The capacity of the destination buffer. 1111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status a reference to a UErrorCode to receive any errors. 1112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the string resulting from the find 1113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and replace operation. In the event that the 1114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destination capacity is inadequate, the return value 1115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is still the full length of the untruncated string. 1116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 1117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_replaceFirst(URegularExpression *regexp, 1120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *replacementText, 1121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t replacementLength, 1122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *destBuf, 1123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1124b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 1125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 112650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 112750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Replaces the first substring of the input that matches the pattern 112850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * with the given replacement string. This is a convenience function that 112950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * provides a complete find-and-replace operation. 113050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 113150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * This method scans the input string looking for a match of the pattern. 113250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * All input that is not part of the match is copied unchanged to the 113350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * destination buffer. The matched region is replaced in the output 113450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * buffer by the replacement string. The replacement string may contain 113550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * references to capture groups; these take the form of $1, $2, etc. 113650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 113750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The compiled regular expression. 113850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param replacement A string containing the replacement text. 113950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A mutable UText that will receive the result. 114050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If NULL, a new UText will be created (which may not be mutable). 114150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status A reference to a UErrorCode to receive any errors. 114250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return A UText containing the results of the find and replace. 114350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If a pre-allocated UText was provided, it will always be used and returned. 114450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 1145103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 114650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 114754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2 114850294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_replaceFirstUText(URegularExpression *regexp, 114950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *replacement, 115050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *dest, 115150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 115250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Implements a replace operation intended to be used as part of an 1155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * incremental find-and-replace. 1156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>The input string, starting from the end of the previous match and ending at 1158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the start of the current match, is appended to the destination string. Then the 1159b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * replacement string is appended to the output string, 1160b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * including handling any substitutions of captured text.</p> 1161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>A note on preflight computation of buffersize and error handling: 1163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Calls to uregex_appendReplacement() and uregex_appendTail() are 1164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * designed to be chained, one after another, with the destination 1165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer pointer and buffer capacity updated after each in preparation 1166b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to for the next. If the destination buffer is exhausted partway through such a 1167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * sequence, a U_BUFFER_OVERFLOW_ERROR status will be returned. Normal 1168b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU conventions are for a function to perform no action if it is 1169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * called with an error status, but for this one case, uregex_appendRepacement() 1170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will operate normally so that buffer size computations will complete 1171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * correctly. 1172b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p>For simple, prepackaged, non-incremental find-and-replace 1174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * operations, see replaceFirst() or replaceAll().</p> 1175b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1176b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The regular expression object. 1177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementText The string that will replace the matched portion of the 1178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * input string as it is copied to the destination buffer. 1179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The replacement text may contain references ($1, for 1180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * example) to capture groups from the match. 1181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param replacementLength The length of the replacement text string, 1182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or -1 if the string is NUL terminated. 1183b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destBuf The buffer into which the results of the 1184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * find-and-replace are placed. On return, this pointer 1185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be updated to refer to the beginning of the 1186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unused portion of buffer, leaving it in position for 1187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a subsequent call to this function. 1188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the output buffer, On return, this 1189b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * parameter will be updated to reflect the space remaining 1190b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unused in the output buffer. 1191b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. In the event that 1193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destCapacity is inadequate, the full length of the 1194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * untruncated output string is returned. 1195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 1197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1199b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1200b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_appendReplacement(URegularExpression *regexp, 120150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho const UChar *replacementText, 120250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t replacementLength, 120350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UChar **destBuf, 120450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t *destCapacity, 120550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 120650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 120750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 120850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Implements a replace operation intended to be used as part of an 120950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * incremental find-and-replace. 121050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 121150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * <p>The input string, starting from the end of the previous match and ending at 121250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * the start of the current match, is appended to the destination string. Then the 121350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * replacement string is appended to the output string, 121450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * including handling any substitutions of captured text.</p> 121550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 121650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * <p>For simple, prepackaged, non-incremental find-and-replace 121750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * operations, see replaceFirst() or replaceAll().</p> 121850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 121950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The regular expression object. 122050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param replacementText The string that will replace the matched portion of the 122150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * input string as it is copied to the destination buffer. 122250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The replacement text may contain references ($1, for 122350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * example) to capture groups from the match. 122450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A mutable UText that will receive the result. Must not be NULL. 122550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status A reference to a UErrorCode to receive any errors. 122650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 1227103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 122850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 122954dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 123050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_appendReplacementUText(URegularExpression *regexp, 123150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *replacementText, 123250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *dest, 123350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 1234b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 1236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * As the final step in a find-and-replace operation, append the remainder 1237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * of the input string, starting at the position following the last match, 1238b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to the destination string. <code>uregex_appendTail()</code> is intended 1239b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to be invoked after one or more invocations of the 1240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code>uregex_appendReplacement()</code> function. 1241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The regular expression object. This is needed to 1243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * obtain the input string and with the position 1244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * of the last match within it. 1245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destBuf The buffer in which the results of the 1246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * find-and-replace are placed. On return, the pointer 1247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will be updated to refer to the beginning of the 1248b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unused portion of buffer. 1249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the output buffer, On return, this 1250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * value will be updated to reflect the space remaining 1251b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * unused in the output buffer. 1252b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1253b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the result string. In the event that 1254b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destCapacity is inadequate, the full length of the 1255b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * untruncated output string is returned. 1256b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1257b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 1258b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1259b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1260b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_appendTail(URegularExpression *regexp, 1261b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar **destBuf, 1262b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *destCapacity, 1263b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 1264b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 126550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 126650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * As the final step in a find-and-replace operation, append the remainder 126750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of the input string, starting at the position following the last match, 126850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to the destination string. <code>uregex_appendTailUText()</code> is intended 126950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * to be invoked after one or more invocations of the 127050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * <code>uregex_appendReplacementUText()</code> function. 127150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 127250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The regular expression object. This is needed to 127350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * obtain the input string and with the position 127450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of the last match within it. 127550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param dest A mutable UText that will receive the result. Must not be NULL. 1276b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 1277b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param status Error code 1278b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 127950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return The destination UText. 128050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 1281103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 128250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 128354dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE UText * U_EXPORT2 128450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_appendTailUText(URegularExpression *regexp, 128527f654740f2a26ad62a5c155af9199af9e69b889claireho UText *dest, 128627f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 1287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 1289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Split a string into fields. Somewhat like split() from Perl. 1290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The pattern matches identify delimiters that separate the input 1291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * into fields. The input data between the matches becomes the 1292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * fields themselves. 1293b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 1294b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Each of the fields is copied from the input string to the destination 129550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * buffer, and NUL terminated. The position of each field within 1296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the destination buffer is returned in the destFields array. 1297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1298b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * If the delimiter pattern includes capture groups, the captured text will 1299b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * also appear in the destination array of output strings, interspersed 1300b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * with the fields. This is similar to Perl, but differs from Java, 1301b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * which ignores the presence of capture groups in the pattern. 1302b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 1303b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Trailing empty fields will always be returned, assuming sufficient 1304b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * destination capacity. This differs from the default behavior for Java 1305b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * and Perl where trailing empty fields are not returned. 1306b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * 1307b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * The number of strings produced by the split operation is returned. 1308b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * This count includes the strings from capture groups in the delimiter pattern. 1309b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * This behavior differs from Java, which ignores capture groups. 1310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param regexp The compiled regular expression. 1312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destBuf A (UChar *) buffer to receive the fields that 1313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * are extracted from the input string. These 1314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * field pointers will refer to positions within the 1315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * destination buffer supplied by the caller. Any 1316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * extra positions within the destFields array will be 1317b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * set to NULL. 1318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The capacity of the destBuf. 1319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param requiredCapacity The actual capacity required of the destBuf. 1320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If destCapacity is too small, requiredCapacity will return 1321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the total capacity required to hold all of the output, and 1322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a U_BUFFER_OVERFLOW_ERROR will be returned. 1323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destFields An array to be filled with the position of each 1324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * of the extracted fields within destBuf. 1325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destFieldsCapacity The number of elements in the destFields array. 1326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the number of fields found is less than destFieldsCapacity, 1327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the extra destFields elements are set to zero. 1328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If destFieldsCapacity is too small, the trailing part of the 1329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * input, including any field delimiters, is treated as if it 1330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * were the last field - it is copied to the destBuf, and 1331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * its position is in the destBuf is stored in the last element 1332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * of destFields. This behavior mimics that of Perl. It is not 1333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * an error condition, and no error status is returned when all destField 1334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * positions are used. 1335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The number of fields into which the input string was split. 1337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.0 1338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 1340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuregex_split( URegularExpression *regexp, 1341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *destBuf, 1342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 1343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t *requiredCapacity, 1344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar *destFields[], 1345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destFieldsCapacity, 1346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 1347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 134850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho /** 134950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * Split a string into fields. Somewhat like split() from Perl. 135050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The pattern matches identify delimiters that separate the input 135150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * into fields. The input data between the matches becomes the 135250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * fields themselves. 135350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * <p> 135450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * The behavior of this function is not very closely aligned with uregex_split(); 135550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * instead, it is based on (and implemented directly on top of) the C++ split method. 135650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 135750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param regexp The compiled regular expression. 135850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param destFields An array of mutable UText structs to receive the results of the split. 135950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If a field is NULL, a new UText is allocated to contain the results for 136050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * that field. This new UText is not guaranteed to be mutable. 136150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param destFieldsCapacity The number of elements in the destination array. 136250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If the number of fields found is less than destCapacity, the 136350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * extra strings in the destination array are not altered. 136450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * If the number of destination strings is less than the number 136550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * of fields, the trailing part of the input string, including any 136650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * field delimiters, is placed in the last destination string. 136750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * This behavior mimics that of Perl. It is not an error condition, and no 136850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * error status is returned when all destField positions are used. 136950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @param status A reference to a UErrorCode to receive any errors. 137050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return The number of fields into which the input string was split. 137150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 1372103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 137350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 137454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE int32_t U_EXPORT2 137550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehouregex_splitUText(URegularExpression *regexp, 137650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UText *destFields[], 137750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho int32_t destFieldsCapacity, 137850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho UErrorCode *status); 137950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 1380c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1381c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Set a processing time limit for match operations with this URegularExpression. 1382c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1383c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Some patterns, when matching certain strings, can run in exponential time. 1384c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * For practical purposes, the match operation may appear to be in an 1385c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * infinite loop. 1386c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * When a limit is set a match operation will fail with an error if the 1387c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * limit is exceeded. 1388c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1389c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * The units of the limit are steps of the match engine. 1390c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Correspondence with actual processor time will depend on the speed 1391c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * of the processor and the details of the specific pattern, but will 1392c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * typically be on the order of milliseconds. 1393c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1394c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * By default, the matching time is not limited. 1395c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1396c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1397c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1398c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param limit The limit value, or 0 for no limit. 1399c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1400b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1401c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 140250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 1403c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setTimeLimit(URegularExpression *regexp, 1404c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t limit, 1405c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1406c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1407c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1408c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the time limit for for matches with this URegularExpression. 1409c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * A return value of zero indicates that there is no limit. 1410c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1411c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1412c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1413c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return the maximum allowed time for a match, in units of processing steps. 1414b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1415c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 141650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 1417c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getTimeLimit(const URegularExpression *regexp, 1418c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1419c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1420c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1421b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * Set the amount of heap storage available for use by the match backtracking stack. 1422c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1423c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * ICU uses a backtracking regular expression engine, with the backtrack stack 1424c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * maintained on the heap. This function sets the limit to the amount of memory 1425c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * that can be used for this purpose. A backtracking stack overflow will 1426c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * result in an error from the match operation that caused it. 1427c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1428c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * A limit is desirable because a malicious or poorly designed pattern can use 1429c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * excessive memory, potentially crashing the process. A limit is enabled 1430c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * by default. 1431c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * <p> 1432c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1433c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param limit The maximum size, in bytes, of the matching backtrack stack. 143459d709d503bab6e2b61931737e662dd293b40578ccornelius * A value of zero means no limit. 143559d709d503bab6e2b61931737e662dd293b40578ccornelius * The limit must be greater than or equal to zero. 1436c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1437c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1438b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1439c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 144050294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 1441c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setStackLimit(URegularExpression *regexp, 1442c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t limit, 1443c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1444c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1445c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1446c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the size of the heap storage available for use by the back tracking stack. 1447c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1448c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return the maximum backtracking stack size, in bytes, or zero if the 1449c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * stack size is unlimited. 1450b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1451c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 145250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 1453c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getStackLimit(const URegularExpression *regexp, 1454c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1455c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1456c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1457c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1458c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Function pointer for a regular expression matching callback function. 1459c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * When set, a callback function will be called periodically during matching 1460c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * operations. If the call back function returns FALSE, the matching 1461c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * operation will be terminated early. 1462c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1463c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Note: the callback function must not call other functions on this 1464c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * URegularExpression. 1465c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1466c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param context context pointer. The callback function will be invoked 1467c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * with the context specified at the time that 1468c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * uregex_setMatchCallback() is called. 1469c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param steps the accumulated processing time, in match steps, 1470c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * for this matching operation. 1471c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return TRUE to continue the matching operation. 1472c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * FALSE to terminate the matching operation. 1473b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1474c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 1475c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste QueruU_CDECL_BEGIN 1476c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Querutypedef UBool U_CALLCONV URegexMatchCallback ( 1477c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru const void *context, 1478c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t steps); 1479c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste QueruU_CDECL_END 1480c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1481c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1482c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Set a callback function for this URegularExpression. 1483c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * During matching operations the function will be called periodically, 1484c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * giving the application the opportunity to terminate a long-running 1485c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * match. 1486c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1487c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1488c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param callback A pointer to the user-supplied callback function. 1489c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param context User context pointer. The value supplied at the 1490c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * time the callback function is set will be saved 1491c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * and passed to the callback each time that it is called. 1492c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1493b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1494c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 149550294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 1496c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_setMatchCallback(URegularExpression *regexp, 1497c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru URegexMatchCallback *callback, 1498c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru const void *context, 1499c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1500c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1501c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1502c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1503c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the callback function for this URegularExpression. 1504c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1505c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param regexp The compiled regular expression. 1506b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param callback Out parameter, receives a pointer to the user-supplied 1507c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * callback function. 1508c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param context Out parameter, receives the user context pointer that 1509c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * was set when uregex_setMatchCallback() was called. 1510c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status A reference to a UErrorCode to receive any errors. 1511b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1512c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 151350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE void U_EXPORT2 1514c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuregex_getMatchCallback(const URegularExpression *regexp, 1515c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru URegexMatchCallback **callback, 1516c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru const void **context, 1517c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 1518c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 151927f654740f2a26ad62a5c155af9199af9e69b889claireho/** 152027f654740f2a26ad62a5c155af9199af9e69b889claireho * Function pointer for a regular expression find callback function. 152127f654740f2a26ad62a5c155af9199af9e69b889claireho * 152227f654740f2a26ad62a5c155af9199af9e69b889claireho * When set, a callback function will be called during a find operation 152327f654740f2a26ad62a5c155af9199af9e69b889claireho * and for operations that depend on find, such as findNext, split and some replace 152427f654740f2a26ad62a5c155af9199af9e69b889claireho * operations like replaceFirst. 152527f654740f2a26ad62a5c155af9199af9e69b889claireho * The callback will usually be called after each attempt at a match, but this is not a 152627f654740f2a26ad62a5c155af9199af9e69b889claireho * guarantee that the callback will be invoked at each character. For finds where the 152727f654740f2a26ad62a5c155af9199af9e69b889claireho * match engine is invoked at each character, this may be close to true, but less likely 152827f654740f2a26ad62a5c155af9199af9e69b889claireho * for more optimized loops where the pattern is known to only start, and the match 152927f654740f2a26ad62a5c155af9199af9e69b889claireho * engine invoked, at certain characters. 153027f654740f2a26ad62a5c155af9199af9e69b889claireho * When invoked, this callback will specify the index at which a match operation is about 153127f654740f2a26ad62a5c155af9199af9e69b889claireho * to be attempted, giving the application the opportunity to terminate a long-running 153227f654740f2a26ad62a5c155af9199af9e69b889claireho * find operation. 153327f654740f2a26ad62a5c155af9199af9e69b889claireho * 153427f654740f2a26ad62a5c155af9199af9e69b889claireho * If the call back function returns FALSE, the find operation will be terminated early. 153527f654740f2a26ad62a5c155af9199af9e69b889claireho * 153627f654740f2a26ad62a5c155af9199af9e69b889claireho * Note: the callback function must not call other functions on this 153727f654740f2a26ad62a5c155af9199af9e69b889claireho * URegularExpression 153827f654740f2a26ad62a5c155af9199af9e69b889claireho * 153927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param context context pointer. The callback function will be invoked 154027f654740f2a26ad62a5c155af9199af9e69b889claireho * with the context specified at the time that 154127f654740f2a26ad62a5c155af9199af9e69b889claireho * uregex_setFindProgressCallback() is called. 154227f654740f2a26ad62a5c155af9199af9e69b889claireho * @param matchIndex the next index at which a match attempt will be attempted for this 154327f654740f2a26ad62a5c155af9199af9e69b889claireho * find operation. If this callback interrupts the search, this is the 154427f654740f2a26ad62a5c155af9199af9e69b889claireho * index at which a find/findNext operation may be re-initiated. 154527f654740f2a26ad62a5c155af9199af9e69b889claireho * @return TRUE to continue the matching operation. 154627f654740f2a26ad62a5c155af9199af9e69b889claireho * FALSE to terminate the matching operation. 1547103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 154827f654740f2a26ad62a5c155af9199af9e69b889claireho */ 154927f654740f2a26ad62a5c155af9199af9e69b889clairehoU_CDECL_BEGIN 155027f654740f2a26ad62a5c155af9199af9e69b889clairehotypedef UBool U_CALLCONV URegexFindProgressCallback ( 155127f654740f2a26ad62a5c155af9199af9e69b889claireho const void *context, 155227f654740f2a26ad62a5c155af9199af9e69b889claireho int64_t matchIndex); 155327f654740f2a26ad62a5c155af9199af9e69b889clairehoU_CDECL_END 155427f654740f2a26ad62a5c155af9199af9e69b889claireho 1555103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius 155627f654740f2a26ad62a5c155af9199af9e69b889claireho/** 155727f654740f2a26ad62a5c155af9199af9e69b889claireho * Set the find progress callback function for this URegularExpression. 155827f654740f2a26ad62a5c155af9199af9e69b889claireho * 155927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param regexp The compiled regular expression. 156027f654740f2a26ad62a5c155af9199af9e69b889claireho * @param callback A pointer to the user-supplied callback function. 156127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param context User context pointer. The value supplied at the 156227f654740f2a26ad62a5c155af9199af9e69b889claireho * time the callback function is set will be saved 156327f654740f2a26ad62a5c155af9199af9e69b889claireho * and passed to the callback each time that it is called. 156427f654740f2a26ad62a5c155af9199af9e69b889claireho * @param status A reference to a UErrorCode to receive any errors. 1565103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 156627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 156754dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 156827f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_setFindProgressCallback(URegularExpression *regexp, 156927f654740f2a26ad62a5c155af9199af9e69b889claireho URegexFindProgressCallback *callback, 157027f654740f2a26ad62a5c155af9199af9e69b889claireho const void *context, 157127f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 157227f654740f2a26ad62a5c155af9199af9e69b889claireho 157327f654740f2a26ad62a5c155af9199af9e69b889claireho/** 157427f654740f2a26ad62a5c155af9199af9e69b889claireho * Get the find progress callback function for this URegularExpression. 157527f654740f2a26ad62a5c155af9199af9e69b889claireho * 157627f654740f2a26ad62a5c155af9199af9e69b889claireho * @param regexp The compiled regular expression. 1577b26ce3a7367e4ed2ee7ddddcdc3f3d3377a455c2claireho * @param callback Out parameter, receives a pointer to the user-supplied 157827f654740f2a26ad62a5c155af9199af9e69b889claireho * callback function. 157927f654740f2a26ad62a5c155af9199af9e69b889claireho * @param context Out parameter, receives the user context pointer that 158027f654740f2a26ad62a5c155af9199af9e69b889claireho * was set when uregex_setFindProgressCallback() was called. 158127f654740f2a26ad62a5c155af9199af9e69b889claireho * @param status A reference to a UErrorCode to receive any errors. 1582103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius * @stable ICU 4.6 158327f654740f2a26ad62a5c155af9199af9e69b889claireho */ 158454dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusU_STABLE void U_EXPORT2 158527f654740f2a26ad62a5c155af9199af9e69b889clairehouregex_getFindProgressCallback(const URegularExpression *regexp, 158627f654740f2a26ad62a5c155af9199af9e69b889claireho URegexFindProgressCallback **callback, 158727f654740f2a26ad62a5c155af9199af9e69b889claireho const void **context, 158827f654740f2a26ad62a5c155af9199af9e69b889claireho UErrorCode *status); 1589c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */ 1591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* UREGEX_H */ 1592