[glibmm/glibmm-2-62] Glib::Regex doc: Note that Glib::ustring must be used in match methods
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-62] Glib::Regex doc: Note that Glib::ustring must be used in match methods
- Date: Fri, 22 Nov 2019 18:16:23 +0000 (UTC)
commit d7cc9644e1d75ff3244b01fbeadb27e79e404c03
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Nov 22 19:14:25 2019 +0100
Glib::Regex doc: Note that Glib::ustring must be used in match methods
See issue #66 and MR !25
glib/src/regex.hg | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/glib/src/regex.hg b/glib/src/regex.hg
index 05558859..1b9eb443 100644
--- a/glib/src/regex.hg
+++ b/glib/src/regex.hg
@@ -90,6 +90,18 @@ class MatchInfo;
* The regular expressions low level functionalities are obtained through the
* excellent PCRE library written by Philip Hazel.
*
+ * @note When you call a match() or a match_all() method taking a MatchInfo,
+ * use a Glib::ustring that still exists when you later call MatchInfo methods.
+ * If you call match() or match_all() with a std::string or a string literal,
+ * the method will internally use a temporary copy of the string. The copy will
+ * not exist when you call MatchInfo methods.
+ * @code
+ * Glib::ustring str1 = "String to search through";
+ * regex->match(str1, match_info);
+ * // ...
+ * if (match_info.matches()) // str1 must still exist here
+ * @endcode
+ *
* @newin{2,14}
*/
class Regex final
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]