⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-perl-compatible-regular-expressions.html

📁 最新gtk中文资料集
💻 HTML
📖 第 1 页 / 共 5 页
字号:
the pattern.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-RAW:CAPS"></a><code class="literal">G_REGEX_RAW</code></span></p></td><td>Usually strings must be valid UTF-8 strings, using thisflag they are considered as a raw sequence of bytes.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-NO-AUTO-CAPTURE:CAPS"></a><code class="literal">G_REGEX_NO_AUTO_CAPTURE</code></span></p></td><td>Disables the use of numbered capturingparentheses in the pattern. Any opening parenthesis that is not followedby "?" behaves as if it were followed by "?:" but named parentheses canstill be used for capturing (and they acquire numbers in the usual way).</td></tr><tr><td><p><span class="term"><a name="G-REGEX-OPTIMIZE:CAPS"></a><code class="literal">G_REGEX_OPTIMIZE</code></span></p></td><td>Optimize the regular expression. If the pattern willbe used many times, then it may be worth the effort to optimize it toimprove the speed of matches.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-DUPNAMES:CAPS"></a><code class="literal">G_REGEX_DUPNAMES</code></span></p></td><td>Names used to identify capturing subpatterns need notbe unique. This can be helpful for certain types of pattern when it is knownthat only one instance of the named subpattern can ever be matched.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-NEWLINE-CR:CAPS"></a><code class="literal">G_REGEX_NEWLINE_CR</code></span></p></td><td>Usually any newline character is recognized, if thisoption is set, the only recognized newline character is '\r'.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-NEWLINE-LF:CAPS"></a><code class="literal">G_REGEX_NEWLINE_LF</code></span></p></td><td>Usually any newline character is recognized, if thisoption is set, the only recognized newline character is '\n'.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-NEWLINE-CRLF:CAPS"></a><code class="literal">G_REGEX_NEWLINE_CRLF</code></span></p></td><td>Usually any newline character is recognized, if thisoption is set, the only recognized newline character sequence is '\r\n'.</td></tr></tbody></table></div><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3146052"></a><h3><a name="GRegexMatchFlags"></a>enum GRegexMatchFlags</h3><a class="indexterm" name="id3146067"></a><pre class="programlisting">typedef enum{  G_REGEX_MATCH_ANCHORED      = 1 &lt;&lt; 4,  G_REGEX_MATCH_NOTBOL        = 1 &lt;&lt; 7,  G_REGEX_MATCH_NOTEOL        = 1 &lt;&lt; 8,  G_REGEX_MATCH_NOTEMPTY      = 1 &lt;&lt; 10,  G_REGEX_MATCH_PARTIAL       = 1 &lt;&lt; 15,  G_REGEX_MATCH_NEWLINE_CR    = 1 &lt;&lt; 20,  G_REGEX_MATCH_NEWLINE_LF    = 1 &lt;&lt; 21,  G_REGEX_MATCH_NEWLINE_CRLF  = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF,  G_REGEX_MATCH_NEWLINE_ANY   = 1 &lt;&lt; 22} GRegexMatchFlags;</pre><p>Flags specifying match-time options.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="G-REGEX-MATCH-ANCHORED:CAPS"></a><code class="literal">G_REGEX_MATCH_ANCHORED</code></span></p></td><td>The pattern is forced to be "anchored", that is,it is constrained to match only at the first matching point in the stringthat is being searched. This effect can also be achieved by appropriateconstructs in the pattern itself such as the "^" metacharater.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NOTBOL:CAPS"></a><code class="literal">G_REGEX_MATCH_NOTBOL</code></span></p></td><td>Specifies that first character of the string isnot the beginning of a line, so the circumflex metacharacter should notmatch before it. Setting this without G_REGEX_MULTILINE (at compile time)causes circumflex never to match. This option affects only the behaviour ofthe circumflex metacharacter, it does not affect "\A".</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NOTEOL:CAPS"></a><code class="literal">G_REGEX_MATCH_NOTEOL</code></span></p></td><td>Specifies that the end of the subject string isnot the end of a line, so the dollar metacharacter should not match it nor(except in multiline mode) a newline immediately before it. Setting thiswithout G_REGEX_MULTILINE (at compile time) causes dollar never to match.This option affects only the behaviour of the dollar metacharacter, it doesnot affect "\Z" or "\z".</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NOTEMPTY:CAPS"></a><code class="literal">G_REGEX_MATCH_NOTEMPTY</code></span></p></td><td>An empty string is not considered to be a validmatch if this option is set. If there are alternatives in the pattern, theyare tried. If all the alternatives match the empty string, the entire matchfails. For example, if the pattern "a?b?" is applied to a string not beginningwith "a" or "b", it matches the empty string at the start of the string.With this flag set, this match is not valid, so GRegex searches furtherinto the string for occurrences of "a" or "b".</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-PARTIAL:CAPS"></a><code class="literal">G_REGEX_MATCH_PARTIAL</code></span></p></td><td>Turns on the partial matching feature, for moredocumentation on partial matching see <code class="function">g_regex_is_partial_match()</code>.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NEWLINE-CR:CAPS"></a><code class="literal">G_REGEX_MATCH_NEWLINE_CR</code></span></p></td><td>Overrides the newline definition set when creatinga new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex"><span class="type">GRegex</span></a>, setting the '\r' character as line terminator.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NEWLINE-LF:CAPS"></a><code class="literal">G_REGEX_MATCH_NEWLINE_LF</code></span></p></td><td>Overrides the newline definition set when creatinga new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex"><span class="type">GRegex</span></a>, setting the '\n' character as line terminator.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NEWLINE-CRLF:CAPS"></a><code class="literal">G_REGEX_MATCH_NEWLINE_CRLF</code></span></p></td><td>Overrides the newline definition set when creatinga new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex"><span class="type">GRegex</span></a>, setting the '\r\n' characters as line terminator.</td></tr><tr><td><p><span class="term"><a name="G-REGEX-MATCH-NEWLINE-ANY:CAPS"></a><code class="literal">G_REGEX_MATCH_NEWLINE_ANY</code></span></p></td><td>Overrides the newline definition set when creatinga new <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex"><span class="type">GRegex</span></a>, any newline character or character sequence is recognized.</td></tr></tbody></table></div><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3146381"></a><h3><a name="GRegex"></a>GRegex</h3><a class="indexterm" name="id3146395"></a><pre class="programlisting">typedef struct _GRegex GRegex;</pre><p>A GRegex is the "compiled" form of a regular expression pattern. Thisstructure is opaque and its fields cannot be accessed directly.</p><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3146419"></a><h3><a name="GRegexEvalCallback"></a>GRegexEvalCallback ()</h3><a class="indexterm" name="id3146435"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (*GRegexEvalCallback)               (const <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo">GMatchInfo</a> *match_info,                                                         <a class="link" href="glib-Strings.html#GString">GString</a> *result,                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Specifies the type of the function passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval"><code class="function">g_regex_replace_eval()</code></a>.It is called for each occurance of the pattern in the string passedto <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval"><code class="function">g_regex_replace_eval()</code></a>, and it should append the replacement to<em class="parameter"><code>result</code></em>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>match_info</code></em>&#160;:</span></p></td><td>the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GMatchInfo"><span class="type">GMatchInfo</span></a> generated by the match. Use <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-regex"><code class="function">g_match_info_get_regex()</code></a> and <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-match-info-get-string"><code class="function">g_match_info_get_string()</code></a> if you need the <a class="link" href="glib-Perl-compatible-regular-expressions.html#GRegex"><span class="type">GRegex</span></a> or the matched string.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>result</code></em>&#160;:</span></p></td><td>a <a class="link" href="glib-Strings.html#GString"><span class="type">GString</span></a> containing the new string</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td><td>user data passed to <a class="link" href="glib-Perl-compatible-regular-expressions.html#g-regex-replace-eval"><code class="function">g_regex_replace_eval()</code></a></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td><td><a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to continue the replacement process, <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to stop it</td></tr></tbody>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -