1 /* GRegex -- regular expression API wrapper around PCRE.
3 * Copyright (C) 1999, 2000 Scott Wimer
4 * Copyright (C) 2004, Matthias Clasen <mclasen@redhat.com>
5 * Copyright (C) 2005 - 2006, Marco Barisione <marco@barisione.org>
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.
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.
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
31 G_REGEX_ERROR_COMPILE,
32 G_REGEX_ERROR_OPTIMIZE,
33 G_REGEX_ERROR_REPLACE,
37 #define G_REGEX_ERROR g_regex_error_quark ()
39 GQuark g_regex_error_quark (void);
41 /* Remember to update G_REGEX_COMPILE_MASK in gregex.c after
42 * adding a new flag. */
45 G_REGEX_CASELESS = 1 << 0,
46 G_REGEX_MULTILINE = 1 << 1,
47 G_REGEX_DOTALL = 1 << 2,
48 G_REGEX_EXTENDED = 1 << 3,
49 G_REGEX_ANCHORED = 1 << 4,
50 G_REGEX_DOLLAR_ENDONLY = 1 << 5,
51 G_REGEX_UNGREEDY = 1 << 9,
52 G_REGEX_RAW = 1 << 11,
53 G_REGEX_NO_AUTO_CAPTURE = 1 << 12,
54 G_REGEX_DUPNAMES = 1 << 19,
55 G_REGEX_NEWLINE_CR = 1 << 20,
56 G_REGEX_NEWLINE_LF = 1 << 21,
57 G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF
60 /* Remember to update G_REGEX_MATCH_MASK in gregex.c after
61 * adding a new flag. */
64 G_REGEX_MATCH_ANCHORED = 1 << 4,
65 G_REGEX_MATCH_NOTBOL = 1 << 7,
66 G_REGEX_MATCH_NOTEOL = 1 << 8,
67 G_REGEX_MATCH_NOTEMPTY = 1 << 10,
68 G_REGEX_MATCH_PARTIAL = 1 << 15,
69 G_REGEX_MATCH_NEWLINE_CR = 1 << 20,
70 G_REGEX_MATCH_NEWLINE_LF = 1 << 21,
71 G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF,
72 G_REGEX_MATCH_NEWLINE_ANY = 1 << 22,
75 typedef struct _GRegex GRegex;
77 typedef gboolean (*GRegexEvalCallback) (const GRegex*, const gchar*, GString*, gpointer);
80 GRegex *g_regex_new (const gchar *pattern,
81 GRegexCompileFlags compile_options,
82 GRegexMatchFlags match_options,
84 void g_regex_free (GRegex *regex);
85 gboolean g_regex_optimize (GRegex *regex,
87 GRegex *g_regex_copy (const GRegex *regex);
88 const gchar *g_regex_get_pattern (const GRegex *regex);
89 void g_regex_clear (GRegex *regex);
90 gboolean g_regex_match_simple (const gchar *pattern,
92 GRegexCompileFlags compile_options,
93 GRegexMatchFlags match_options);
94 gboolean g_regex_match (GRegex *regex,
96 GRegexMatchFlags match_options);
97 gboolean g_regex_match_full (GRegex *regex,
101 GRegexMatchFlags match_options,
103 gboolean g_regex_match_next (GRegex *regex,
105 GRegexMatchFlags match_options);
106 gboolean g_regex_match_next_full (GRegex *regex,
110 GRegexMatchFlags match_options,
112 gboolean g_regex_match_all (GRegex *regex,
114 GRegexMatchFlags match_options);
115 gboolean g_regex_match_all_full (GRegex *regex,
119 GRegexMatchFlags match_options,
121 gint g_regex_get_match_count (const GRegex *regex);
122 gboolean g_regex_is_partial_match (const GRegex *regex);
123 gchar *g_regex_fetch (const GRegex *regex,
125 const gchar *string);
126 gboolean g_regex_fetch_pos (const GRegex *regex,
130 gchar *g_regex_fetch_named (const GRegex *regex,
132 const gchar *string);
133 gboolean g_regex_fetch_named_pos (const GRegex *regex,
137 gchar **g_regex_fetch_all (const GRegex *regex,
138 const gchar *string);
139 gint g_regex_get_string_number (const GRegex *regex,
141 gchar **g_regex_split_simple (const gchar *pattern,
143 GRegexCompileFlags compile_options,
144 GRegexMatchFlags match_options);
145 gchar **g_regex_split (GRegex *regex,
147 GRegexMatchFlags match_options);
148 gchar **g_regex_split_full (GRegex *regex,
152 GRegexMatchFlags match_options,
155 gchar *g_regex_split_next (GRegex *regex,
157 GRegexMatchFlags match_options);
158 gchar *g_regex_split_next_full (GRegex *regex,
162 GRegexMatchFlags match_options,
164 gchar *g_regex_expand_references (GRegex *regex,
166 const gchar *string_to_expand,
168 gchar *g_regex_replace (GRegex *regex,
172 const gchar *replacement,
173 GRegexMatchFlags match_options,
175 gchar *g_regex_replace_literal (GRegex *regex,
179 const gchar *replacement,
180 GRegexMatchFlags match_options,
182 gchar *g_regex_replace_eval (GRegex *regex,
186 GRegexMatchFlags match_options,
187 GRegexEvalCallback eval,
190 gchar *g_regex_escape_string (const gchar *string,
197 #endif /* __G_REGEX_H__ */