Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

472 linhas
21 KiB

  1. /* GRegex -- regular expression API wrapper around PCRE.
  2. *
  3. * Copyright (C) 1999, 2000 Scott Wimer
  4. * Copyright (C) 2004, Matthias Clasen <mclasen@redhat.com>
  5. * Copyright (C) 2005 - 2007, Marco Barisione <marco@barisione.org>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
  22. #error "Only <glib.h> can be included directly."
  23. #endif
  24. #ifndef __G_REGEX_H__
  25. #define __G_REGEX_H__
  26. #include <glib/gerror.h>
  27. #include <glib/gstring.h>
  28. G_BEGIN_DECLS
  29. /**
  30. * GRegexError:
  31. * @G_REGEX_ERROR_COMPILE: Compilation of the regular expression failed.
  32. * @G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression failed.
  33. * @G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement
  34. * string.
  35. * @G_REGEX_ERROR_MATCH: The match process failed.
  36. * @G_REGEX_ERROR_INTERNAL: Internal error of the regular expression engine.
  37. * Since 2.16
  38. * @G_REGEX_ERROR_STRAY_BACKSLASH: "\\" at end of pattern. Since 2.16
  39. * @G_REGEX_ERROR_MISSING_CONTROL_CHAR: "\\c" at end of pattern. Since 2.16
  40. * @G_REGEX_ERROR_UNRECOGNIZED_ESCAPE: Unrecognized character follows "\\".
  41. * Since 2.16
  42. * @G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER: Numbers out of order in "{}"
  43. * quantifier. Since 2.16
  44. * @G_REGEX_ERROR_QUANTIFIER_TOO_BIG: Number too big in "{}" quantifier.
  45. * Since 2.16
  46. * @G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS: Missing terminating "]" for
  47. * character class. Since 2.16
  48. * @G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS: Invalid escape sequence
  49. * in character class. Since 2.16
  50. * @G_REGEX_ERROR_RANGE_OUT_OF_ORDER: Range out of order in character class.
  51. * Since 2.16
  52. * @G_REGEX_ERROR_NOTHING_TO_REPEAT: Nothing to repeat. Since 2.16
  53. * @G_REGEX_ERROR_UNRECOGNIZED_CHARACTER: Unrecognized character after "(?",
  54. * "(?&lt;" or "(?P". Since 2.16
  55. * @G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS: POSIX named classes are
  56. * supported only within a class. Since 2.16
  57. * @G_REGEX_ERROR_UNMATCHED_PARENTHESIS: Missing terminating ")" or ")"
  58. * without opening "(". Since 2.16
  59. * @G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE: Reference to non-existent
  60. * subpattern. Since 2.16
  61. * @G_REGEX_ERROR_UNTERMINATED_COMMENT: Missing terminating ")" after comment.
  62. * Since 2.16
  63. * @G_REGEX_ERROR_EXPRESSION_TOO_LARGE: Regular expression too large.
  64. * Since 2.16
  65. * @G_REGEX_ERROR_MEMORY_ERROR: Failed to get memory. Since 2.16
  66. * @G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND: Lookbehind assertion is not
  67. * fixed length. Since 2.16
  68. * @G_REGEX_ERROR_MALFORMED_CONDITION: Malformed number or name after "(?(".
  69. * Since 2.16
  70. * @G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES: Conditional group contains
  71. * more than two branches. Since 2.16
  72. * @G_REGEX_ERROR_ASSERTION_EXPECTED: Assertion expected after "(?(".
  73. * Since 2.16
  74. * @G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME: Unknown POSIX class name.
  75. * Since 2.16
  76. * @G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED: POSIX collating
  77. * elements are not supported. Since 2.16
  78. * @G_REGEX_ERROR_HEX_CODE_TOO_LARGE: Character value in "\\x{...}" sequence
  79. * is too large. Since 2.16
  80. * @G_REGEX_ERROR_INVALID_CONDITION: Invalid condition "(?(0)". Since 2.16
  81. * @G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND: \\C not allowed in
  82. * lookbehind assertion. Since 2.16
  83. * @G_REGEX_ERROR_INFINITE_LOOP: Recursive call could loop indefinitely.
  84. * Since 2.16
  85. * @G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR: Missing terminator
  86. * in subpattern name. Since 2.16
  87. * @G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME: Two named subpatterns have
  88. * the same name. Since 2.16
  89. * @G_REGEX_ERROR_MALFORMED_PROPERTY: Malformed "\\P" or "\\p" sequence.
  90. * Since 2.16
  91. * @G_REGEX_ERROR_UNKNOWN_PROPERTY: Unknown property name after "\\P" or
  92. * "\\p". Since 2.16
  93. * @G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG: Subpattern name is too long
  94. * (maximum 32 characters). Since 2.16
  95. * @G_REGEX_ERROR_TOO_MANY_SUBPATTERNS: Too many named subpatterns (maximum
  96. * 10,000). Since 2.16
  97. * @G_REGEX_ERROR_INVALID_OCTAL_VALUE: Octal value is greater than "\\377".
  98. * Since 2.16
  99. * @G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE: "DEFINE" group contains more
  100. * than one branch. Since 2.16
  101. * @G_REGEX_ERROR_DEFINE_REPETION: Repeating a "DEFINE" group is not allowed.
  102. * Since 2.16
  103. * @G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS: Inconsistent newline options.
  104. * Since 2.16
  105. * @G_REGEX_ERROR_MISSING_BACK_REFERENCE: "\\g" is not followed by a braced
  106. * name or an optionally braced non-zero number. Since 2.16
  107. *
  108. * Error codes returned by regular expressions functions.
  109. *
  110. * Since: 2.14
  111. */
  112. typedef enum
  113. {
  114. G_REGEX_ERROR_COMPILE,
  115. G_REGEX_ERROR_OPTIMIZE,
  116. G_REGEX_ERROR_REPLACE,
  117. G_REGEX_ERROR_MATCH,
  118. G_REGEX_ERROR_INTERNAL,
  119. /* These are the error codes from PCRE + 100 */
  120. G_REGEX_ERROR_STRAY_BACKSLASH = 101,
  121. G_REGEX_ERROR_MISSING_CONTROL_CHAR = 102,
  122. G_REGEX_ERROR_UNRECOGNIZED_ESCAPE = 103,
  123. G_REGEX_ERROR_QUANTIFIERS_OUT_OF_ORDER = 104,
  124. G_REGEX_ERROR_QUANTIFIER_TOO_BIG = 105,
  125. G_REGEX_ERROR_UNTERMINATED_CHARACTER_CLASS = 106,
  126. G_REGEX_ERROR_INVALID_ESCAPE_IN_CHARACTER_CLASS = 107,
  127. G_REGEX_ERROR_RANGE_OUT_OF_ORDER = 108,
  128. G_REGEX_ERROR_NOTHING_TO_REPEAT = 109,
  129. G_REGEX_ERROR_UNRECOGNIZED_CHARACTER = 112,
  130. G_REGEX_ERROR_POSIX_NAMED_CLASS_OUTSIDE_CLASS = 113,
  131. G_REGEX_ERROR_UNMATCHED_PARENTHESIS = 114,
  132. G_REGEX_ERROR_INEXISTENT_SUBPATTERN_REFERENCE = 115,
  133. G_REGEX_ERROR_UNTERMINATED_COMMENT = 118,
  134. G_REGEX_ERROR_EXPRESSION_TOO_LARGE = 120,
  135. G_REGEX_ERROR_MEMORY_ERROR = 121,
  136. G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND = 125,
  137. G_REGEX_ERROR_MALFORMED_CONDITION = 126,
  138. G_REGEX_ERROR_TOO_MANY_CONDITIONAL_BRANCHES = 127,
  139. G_REGEX_ERROR_ASSERTION_EXPECTED = 128,
  140. G_REGEX_ERROR_UNKNOWN_POSIX_CLASS_NAME = 130,
  141. G_REGEX_ERROR_POSIX_COLLATING_ELEMENTS_NOT_SUPPORTED = 131,
  142. G_REGEX_ERROR_HEX_CODE_TOO_LARGE = 134,
  143. G_REGEX_ERROR_INVALID_CONDITION = 135,
  144. G_REGEX_ERROR_SINGLE_BYTE_MATCH_IN_LOOKBEHIND = 136,
  145. G_REGEX_ERROR_INFINITE_LOOP = 140,
  146. G_REGEX_ERROR_MISSING_SUBPATTERN_NAME_TERMINATOR = 142,
  147. G_REGEX_ERROR_DUPLICATE_SUBPATTERN_NAME = 143,
  148. G_REGEX_ERROR_MALFORMED_PROPERTY = 146,
  149. G_REGEX_ERROR_UNKNOWN_PROPERTY = 147,
  150. G_REGEX_ERROR_SUBPATTERN_NAME_TOO_LONG = 148,
  151. G_REGEX_ERROR_TOO_MANY_SUBPATTERNS = 149,
  152. G_REGEX_ERROR_INVALID_OCTAL_VALUE = 151,
  153. G_REGEX_ERROR_TOO_MANY_BRANCHES_IN_DEFINE = 154,
  154. G_REGEX_ERROR_DEFINE_REPETION = 155,
  155. G_REGEX_ERROR_INCONSISTENT_NEWLINE_OPTIONS = 156,
  156. G_REGEX_ERROR_MISSING_BACK_REFERENCE = 157
  157. } GRegexError;
  158. /**
  159. * G_REGEX_ERROR:
  160. *
  161. * Error domain for regular expressions. Errors in this domain will be
  162. * from the #GRegexError enumeration. See #GError for information on
  163. * error domains.
  164. *
  165. * Since: 2.14
  166. */
  167. #define G_REGEX_ERROR g_regex_error_quark ()
  168. GQuark g_regex_error_quark (void);
  169. /**
  170. * GRegexCompileFlags:
  171. * @G_REGEX_CASELESS: Letters in the pattern match both upper- and
  172. * lowercase letters. This option can be changed within a pattern
  173. * by a "(?i)" option setting.
  174. * @G_REGEX_MULTILINE: By default, GRegex treats the strings as consisting
  175. * of a single line of characters (even if it actually contains
  176. * newlines). The "start of line" metacharacter ("^") matches only
  177. * at the start of the string, while the "end of line" metacharacter
  178. * ("$") matches only at the end of the string, or before a terminating
  179. * newline (unless #G_REGEX_DOLLAR_ENDONLY is set). When
  180. * #G_REGEX_MULTILINE is set, the "start of line" and "end of line"
  181. * constructs match immediately following or immediately before any
  182. * newline in the string, respectively, as well as at the very start
  183. * and end. This can be changed within a pattern by a "(?m)" option
  184. * setting.
  185. * @G_REGEX_DOTALL: A dot metacharater (".") in the pattern matches all
  186. * characters, including newlines. Without it, newlines are excluded.
  187. * This option can be changed within a pattern by a ("?s") option setting.
  188. * @G_REGEX_EXTENDED: Whitespace data characters in the pattern are
  189. * totally ignored except when escaped or inside a character class.
  190. * Whitespace does not include the VT character (code 11). In addition,
  191. * characters between an unescaped "#" outside a character class and
  192. * the next newline character, inclusive, are also ignored. This can
  193. * be changed within a pattern by a "(?x)" option setting.
  194. * @G_REGEX_ANCHORED: The pattern is forced to be "anchored", that is,
  195. * it is constrained to match only at the first matching point in the
  196. * string that is being searched. This effect can also be achieved by
  197. * appropriate constructs in the pattern itself such as the "^"
  198. * metacharater.
  199. * @G_REGEX_DOLLAR_ENDONLY: A dollar metacharacter ("$") in the pattern
  200. * matches only at the end of the string. Without this option, a
  201. * dollar also matches immediately before the final character if
  202. * it is a newline (but not before any other newlines). This option
  203. * is ignored if #G_REGEX_MULTILINE is set.
  204. * @G_REGEX_UNGREEDY: Inverts the "greediness" of the quantifiers so that
  205. * they are not greedy by default, but become greedy if followed by "?".
  206. * It can also be set by a "(?U)" option setting within the pattern.
  207. * @G_REGEX_RAW: Usually strings must be valid UTF-8 strings, using this
  208. * flag they are considered as a raw sequence of bytes.
  209. * @G_REGEX_NO_AUTO_CAPTURE: Disables the use of numbered capturing
  210. * parentheses in the pattern. Any opening parenthesis that is not
  211. * followed by "?" behaves as if it were followed by "?:" but named
  212. * parentheses can still be used for capturing (and they acquire numbers
  213. * in the usual way).
  214. * @G_REGEX_OPTIMIZE: Optimize the regular expression. If the pattern will
  215. * be used many times, then it may be worth the effort to optimize it
  216. * to improve the speed of matches.
  217. * @G_REGEX_DUPNAMES: Names used to identify capturing subpatterns need not
  218. * be unique. This can be helpful for certain types of pattern when it
  219. * is known that only one instance of the named subpattern can ever be
  220. * matched.
  221. * @G_REGEX_NEWLINE_CR: Usually any newline character is recognized, if this
  222. * option is set, the only recognized newline character is '\r'.
  223. * @G_REGEX_NEWLINE_LF: Usually any newline character is recognized, if this
  224. * option is set, the only recognized newline character is '\n'.
  225. * @G_REGEX_NEWLINE_CRLF: Usually any newline character is recognized, if this
  226. * option is set, the only recognized newline character sequence is '\r\n'.
  227. *
  228. * Flags specifying compile-time options.
  229. *
  230. * Since: 2.14
  231. */
  232. /* Remember to update G_REGEX_COMPILE_MASK in gregex.c after
  233. * adding a new flag. */
  234. typedef enum
  235. {
  236. G_REGEX_CASELESS = 1 << 0,
  237. G_REGEX_MULTILINE = 1 << 1,
  238. G_REGEX_DOTALL = 1 << 2,
  239. G_REGEX_EXTENDED = 1 << 3,
  240. G_REGEX_ANCHORED = 1 << 4,
  241. G_REGEX_DOLLAR_ENDONLY = 1 << 5,
  242. G_REGEX_UNGREEDY = 1 << 9,
  243. G_REGEX_RAW = 1 << 11,
  244. G_REGEX_NO_AUTO_CAPTURE = 1 << 12,
  245. G_REGEX_OPTIMIZE = 1 << 13,
  246. G_REGEX_DUPNAMES = 1 << 19,
  247. G_REGEX_NEWLINE_CR = 1 << 20,
  248. G_REGEX_NEWLINE_LF = 1 << 21,
  249. G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF
  250. } GRegexCompileFlags;
  251. /**
  252. * GRegexMatchFlags:
  253. * @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is,
  254. * it is constrained to match only at the first matching point in the
  255. * string that is being searched. This effect can also be achieved by
  256. * appropriate constructs in the pattern itself such as the "^"
  257. * metacharater.
  258. * @G_REGEX_MATCH_NOTBOL: Specifies that first character of the string is
  259. * not the beginning of a line, so the circumflex metacharacter should
  260. * not match before it. Setting this without #G_REGEX_MULTILINE (at
  261. * compile time) causes circumflex never to match. This option affects
  262. * only the behaviour of the circumflex metacharacter, it does not
  263. * affect "\A".
  264. * @G_REGEX_MATCH_NOTEOL: Specifies that the end of the subject string is
  265. * not the end of a line, so the dollar metacharacter should not match
  266. * it nor (except in multiline mode) a newline immediately before it.
  267. * Setting this without #G_REGEX_MULTILINE (at compile time) causes
  268. * dollar never to match. This option affects only the behaviour of
  269. * the dollar metacharacter, it does not affect "\Z" or "\z".
  270. * @G_REGEX_MATCH_NOTEMPTY: An empty string is not considered to be a valid
  271. * match if this option is set. If there are alternatives in the pattern,
  272. * they are tried. If all the alternatives match the empty string, the
  273. * entire match fails. For example, if the pattern "a?b?" is applied to
  274. * a string not beginning with "a" or "b", it matches the empty string
  275. * at the start of the string. With this flag set, this match is not
  276. * valid, so GRegex searches further into the string for occurrences
  277. * of "a" or "b".
  278. * @G_REGEX_MATCH_PARTIAL: Turns on the partial matching feature, for more
  279. * documentation on partial matching see g_match_info_is_partial_match().
  280. * @G_REGEX_MATCH_NEWLINE_CR: Overrides the newline definition set when
  281. * creating a new #GRegex, setting the '\r' character as line terminator.
  282. * @G_REGEX_MATCH_NEWLINE_LF: Overrides the newline definition set when
  283. * creating a new #GRegex, setting the '\n' character as line terminator.
  284. * @G_REGEX_MATCH_NEWLINE_CRLF: Overrides the newline definition set when
  285. * creating a new #GRegex, setting the '\r\n' characters as line terminator.
  286. * @G_REGEX_MATCH_NEWLINE_ANY: Overrides the newline definition set when
  287. * creating a new #GRegex, any newline character or character sequence
  288. * is recognized.
  289. *
  290. * Flags specifying match-time options.
  291. *
  292. * Since: 2.14
  293. */
  294. /* Remember to update G_REGEX_MATCH_MASK in gregex.c after
  295. * adding a new flag. */
  296. typedef enum
  297. {
  298. G_REGEX_MATCH_ANCHORED = 1 << 4,
  299. G_REGEX_MATCH_NOTBOL = 1 << 7,
  300. G_REGEX_MATCH_NOTEOL = 1 << 8,
  301. G_REGEX_MATCH_NOTEMPTY = 1 << 10,
  302. G_REGEX_MATCH_PARTIAL = 1 << 15,
  303. G_REGEX_MATCH_NEWLINE_CR = 1 << 20,
  304. G_REGEX_MATCH_NEWLINE_LF = 1 << 21,
  305. G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF,
  306. G_REGEX_MATCH_NEWLINE_ANY = 1 << 22
  307. } GRegexMatchFlags;
  308. /**
  309. * GRegex:
  310. *
  311. * A GRegex is the "compiled" form of a regular expression pattern. This
  312. * structure is opaque and its fields cannot be accessed directly.
  313. *
  314. * Since: 2.14
  315. */
  316. typedef struct _GRegex GRegex;
  317. typedef struct _GMatchInfo GMatchInfo;
  318. /**
  319. * GRegexEvalCallback:
  320. * @match_info: the #GMatchInfo generated by the match.
  321. * Use g_match_info_get_regex() and g_match_info_get_string() if you
  322. * need the #GRegex or the matched string.
  323. * @result: a #GString containing the new string
  324. * @user_data: user data passed to g_regex_replace_eval()
  325. *
  326. * Specifies the type of the function passed to g_regex_replace_eval().
  327. * It is called for each occurance of the pattern in the string passed
  328. * to g_regex_replace_eval(), and it should append the replacement to
  329. * @result.
  330. *
  331. * Returns: %FALSE to continue the replacement process, %TRUE to stop it
  332. *
  333. * Since: 2.14
  334. */
  335. typedef gboolean (*GRegexEvalCallback) (const GMatchInfo *match_info,
  336. GString *result,
  337. gpointer user_data);
  338. GRegex *g_regex_new (const gchar *pattern,
  339. GRegexCompileFlags compile_options,
  340. GRegexMatchFlags match_options,
  341. GError **error);
  342. GRegex *g_regex_ref (GRegex *regex);
  343. void g_regex_unref (GRegex *regex);
  344. const gchar *g_regex_get_pattern (const GRegex *regex);
  345. gint g_regex_get_max_backref (const GRegex *regex);
  346. gint g_regex_get_capture_count (const GRegex *regex);
  347. gint g_regex_get_string_number (const GRegex *regex,
  348. const gchar *name);
  349. gchar *g_regex_escape_string (const gchar *string,
  350. gint length);
  351. GRegexCompileFlags g_regex_get_compile_flags (const GRegex *regex);
  352. GRegexMatchFlags g_regex_get_match_flags (const GRegex *regex);
  353. /* Matching. */
  354. gboolean g_regex_match_simple (const gchar *pattern,
  355. const gchar *string,
  356. GRegexCompileFlags compile_options,
  357. GRegexMatchFlags match_options);
  358. gboolean g_regex_match (const GRegex *regex,
  359. const gchar *string,
  360. GRegexMatchFlags match_options,
  361. GMatchInfo **match_info);
  362. gboolean g_regex_match_full (const GRegex *regex,
  363. const gchar *string,
  364. gssize string_len,
  365. gint start_position,
  366. GRegexMatchFlags match_options,
  367. GMatchInfo **match_info,
  368. GError **error);
  369. gboolean g_regex_match_all (const GRegex *regex,
  370. const gchar *string,
  371. GRegexMatchFlags match_options,
  372. GMatchInfo **match_info);
  373. gboolean g_regex_match_all_full (const GRegex *regex,
  374. const gchar *string,
  375. gssize string_len,
  376. gint start_position,
  377. GRegexMatchFlags match_options,
  378. GMatchInfo **match_info,
  379. GError **error);
  380. /* String splitting. */
  381. gchar **g_regex_split_simple (const gchar *pattern,
  382. const gchar *string,
  383. GRegexCompileFlags compile_options,
  384. GRegexMatchFlags match_options);
  385. gchar **g_regex_split (const GRegex *regex,
  386. const gchar *string,
  387. GRegexMatchFlags match_options);
  388. gchar **g_regex_split_full (const GRegex *regex,
  389. const gchar *string,
  390. gssize string_len,
  391. gint start_position,
  392. GRegexMatchFlags match_options,
  393. gint max_tokens,
  394. GError **error);
  395. /* String replacement. */
  396. gchar *g_regex_replace (const GRegex *regex,
  397. const gchar *string,
  398. gssize string_len,
  399. gint start_position,
  400. const gchar *replacement,
  401. GRegexMatchFlags match_options,
  402. GError **error);
  403. gchar *g_regex_replace_literal (const GRegex *regex,
  404. const gchar *string,
  405. gssize string_len,
  406. gint start_position,
  407. const gchar *replacement,
  408. GRegexMatchFlags match_options,
  409. GError **error);
  410. gchar *g_regex_replace_eval (const GRegex *regex,
  411. const gchar *string,
  412. gssize string_len,
  413. gint start_position,
  414. GRegexMatchFlags match_options,
  415. GRegexEvalCallback eval,
  416. gpointer user_data,
  417. GError **error);
  418. gboolean g_regex_check_replacement (const gchar *replacement,
  419. gboolean *has_references,
  420. GError **error);
  421. /* Match info */
  422. GRegex *g_match_info_get_regex (const GMatchInfo *match_info);
  423. const gchar *g_match_info_get_string (const GMatchInfo *match_info);
  424. void g_match_info_free (GMatchInfo *match_info);
  425. gboolean g_match_info_next (GMatchInfo *match_info,
  426. GError **error);
  427. gboolean g_match_info_matches (const GMatchInfo *match_info);
  428. gint g_match_info_get_match_count (const GMatchInfo *match_info);
  429. gboolean g_match_info_is_partial_match (const GMatchInfo *match_info);
  430. gchar *g_match_info_expand_references(const GMatchInfo *match_info,
  431. const gchar *string_to_expand,
  432. GError **error);
  433. gchar *g_match_info_fetch (const GMatchInfo *match_info,
  434. gint match_num);
  435. gboolean g_match_info_fetch_pos (const GMatchInfo *match_info,
  436. gint match_num,
  437. gint *start_pos,
  438. gint *end_pos);
  439. gchar *g_match_info_fetch_named (const GMatchInfo *match_info,
  440. const gchar *name);
  441. gboolean g_match_info_fetch_named_pos (const GMatchInfo *match_info,
  442. const gchar *name,
  443. gint *start_pos,
  444. gint *end_pos);
  445. gchar **g_match_info_fetch_all (const GMatchInfo *match_info);
  446. G_END_DECLS
  447. #endif /* __G_REGEX_H__ */