regex: Add NEWLINE_ANYCRLF match option

This PCRE option is new in PCRE 7.1.
This commit is contained in:
Christian Persch 2012-06-07 15:26:02 +02:00
parent c8c049b177
commit 592531019e
2 changed files with 39 additions and 30 deletions

View File

@ -124,7 +124,8 @@
G_REGEX_MATCH_NEWLINE_CR | \
G_REGEX_MATCH_NEWLINE_LF | \
G_REGEX_MATCH_NEWLINE_CRLF | \
G_REGEX_MATCH_NEWLINE_ANY)
G_REGEX_MATCH_NEWLINE_ANY | \
G_REGEX_MATCH_NEWLINE_ANYCRLF)
/* we rely on these flags having the same values */
G_STATIC_ASSERT (G_REGEX_CASELESS == PCRE_CASELESS);
@ -150,6 +151,7 @@ G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_CR == PCRE_NEWLINE_CR);
G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_LF == PCRE_NEWLINE_LF);
G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_CRLF == PCRE_NEWLINE_CRLF);
G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_ANY == PCRE_NEWLINE_ANY);
G_STATIC_ASSERT (G_REGEX_MATCH_NEWLINE_ANYCRLF == PCRE_NEWLINE_ANYCRLF);
/* if the string is in UTF-8 use g_utf8_ functions, else use
* use just +/- 1. */

View File

@ -331,10 +331,16 @@ typedef enum
* @G_REGEX_MATCH_NEWLINE_LF: Overrides the newline definition set when
* creating a new #GRegex, setting the '\n' character as line terminator.
* @G_REGEX_MATCH_NEWLINE_CRLF: Overrides the newline definition set when
* creating a new #GRegex, setting the '\r\n' characters as line terminator.
* creating a new #GRegex, setting the '\r\n' characters sequence as line terminator.
* @G_REGEX_MATCH_NEWLINE_ANY: Overrides the newline definition set when
* creating a new #GRegex, any newline character or character sequence
* is recognized.
* creating a new #GRegex, any Unicode newline sequence
* is recognised as a newline. These are '\r', '\n' and '\rn', and the
* single characters U+000B LINE TABULATION, U+000C FORM FEED (FF),
* U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and
* U+2029 PARAGRAPH SEPARATOR.
* @G_REGEX_MATCH_NEWLINE_ANYCRLF: Overrides the newline definition set when
* creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence
* is recognized as a newline. Since: 2.34
*
* Flags specifying match-time options.
*
@ -352,7 +358,8 @@ typedef enum
G_REGEX_MATCH_NEWLINE_CR = 1 << 20,
G_REGEX_MATCH_NEWLINE_LF = 1 << 21,
G_REGEX_MATCH_NEWLINE_CRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_LF,
G_REGEX_MATCH_NEWLINE_ANY = 1 << 22
G_REGEX_MATCH_NEWLINE_ANY = 1 << 22,
G_REGEX_MATCH_NEWLINE_ANYCRLF = G_REGEX_MATCH_NEWLINE_CR | G_REGEX_MATCH_NEWLINE_ANY
} GRegexMatchFlags;
/**