summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2012-06-07 16:44:10 +0200
committerChristian Persch <chpe@gnome.org>2012-07-02 15:59:39 +0200
commit88ac3839f5d3d8d05ea7ea391209dff378866f57 (patch)
tree35566cb0c35f6bf4ca9e9da0306eeefe7178af27
parent86a04a05e6b697361c58b1577c52b4a713bf18d3 (diff)
downloadglib-88ac3839f5d3d8d05ea7ea391209dff378866f57.tar.gz
regex: Add BSR_ANYCRLF compile option
When this flag is set, \R only matches CR, LF and CRLF.
-rw-r--r--glib/gregex.c4
-rw-r--r--glib/gregex.h7
2 files changed, 9 insertions, 2 deletions
diff --git a/glib/gregex.c b/glib/gregex.c
index 44fc0496d..a315411af 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -113,7 +113,8 @@
G_REGEX_NEWLINE_CR | \
G_REGEX_NEWLINE_LF | \
G_REGEX_NEWLINE_CRLF | \
- G_REGEX_NEWLINE_ANYCRLF)
+ G_REGEX_NEWLINE_ANYCRLF | \
+ G_REGEX_BSR_ANYCRLF)
/* Mask of all the possible values for GRegexMatchFlags. */
#define G_REGEX_MATCH_MASK (G_REGEX_MATCH_ANCHORED | \
@@ -141,6 +142,7 @@ G_STATIC_ASSERT (G_REGEX_NEWLINE_CR == PCRE_NEWLINE_CR);
G_STATIC_ASSERT (G_REGEX_NEWLINE_LF == PCRE_NEWLINE_LF);
G_STATIC_ASSERT (G_REGEX_NEWLINE_CRLF == PCRE_NEWLINE_CRLF);
G_STATIC_ASSERT (G_REGEX_NEWLINE_ANYCRLF == PCRE_NEWLINE_ANYCRLF);
+G_STATIC_ASSERT (G_REGEX_BSR_ANYCRLF == PCRE_BSR_ANYCRLF);
G_STATIC_ASSERT (G_REGEX_MATCH_ANCHORED == PCRE_ANCHORED);
G_STATIC_ASSERT (G_REGEX_MATCH_NOTBOL == PCRE_NOTBOL);
diff --git a/glib/gregex.h b/glib/gregex.h
index 9b6a5fe70..9045376b7 100644
--- a/glib/gregex.h
+++ b/glib/gregex.h
@@ -271,6 +271,10 @@ GQuark g_regex_error_quark (void);
* @G_REGEX_NEWLINE_ANYCRLF: Usually any newline character or character sequence
* is recognized. If this option is set, the only recognized newline character
* sequences are '\r', '\n', and '\r\n'. Since: 2.34
+ * G_REGEX_BSR_ANYCRLF: Usually any newline character or character sequence
+ * is recognised. If this option is set, then "\R" only recognizes the newline
+ * characters '\r', '\n' and '\r\n'. Since: 2.34
+ *
*
* Flags specifying compile-time options.
*
@@ -294,7 +298,8 @@ typedef enum
G_REGEX_NEWLINE_CR = 1 << 20,
G_REGEX_NEWLINE_LF = 1 << 21,
G_REGEX_NEWLINE_CRLF = G_REGEX_NEWLINE_CR | G_REGEX_NEWLINE_LF,
- G_REGEX_NEWLINE_ANYCRLF = G_REGEX_NEWLINE_CR | 1 << 22
+ G_REGEX_NEWLINE_ANYCRLF = G_REGEX_NEWLINE_CR | 1 << 22,
+ G_REGEX_BSR_ANYCRLF = 1 << 23
} GRegexCompileFlags;
/**