use of backreferences in Glib::Regex::replace
- From: "Andrea Benazzo" <andy qitty net>
- To: gtkmm-list gnome org
- Subject: use of backreferences in Glib::Regex::replace
- Date: Sat, 16 Feb 2008 18:01:55 +0100
Hi *,
I'm trying to use the Glib::Regex::replace method to move parts of a string like in "aaaaa bbbbb" into "bbbbb aaaaaa".
I'm using a regex like "([a-z]+) ([a-z]+)" and the replacement "\2 \1", but I can't manage to correctly use the backreferences.
Here is a snipped of my code:
Glib::RefPtr<Glib::Regex> reg=Glib::Regex::create("([a-z]+) ([a-z]+)");
output_string=reg->replace(input_string,0,"--\2--\1--",Glib::REGEX_MATCH_NEWLINE_ANY);
then the output string is="------"
do you have any hint?
Thanks.
ps: the documentation of the Glib::Regex class should be checked because the descriptions related to method Glib::Regex::replace (among others) is broken due to the heavy use of backslashes in original documentation of Glib.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]