#589 closed Bugs (fixed)
regex_replace bug — at Version 6
Reported by: | nobody | Owned by: | John Maddock |
---|---|---|---|
Milestone: | Component: | regex | |
Version: | None | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
boost::tregex e("(.*)"); strResult = boost::regex_replace("a", e, "$1b"); strResult now equals "abb", but should be "ab". My e-mail: kdn01003@student.mdh.se
Change History (6)
comment:2 by , 17 years ago
Status: | assigned → closed |
---|
comment:3 by , 11 years ago
Severity: | → Problem |
---|
I have found this behavior still exists even when using posix basic or extended regexes. While this behavior may be correct for perl regexes it doesn't seem to be correct for posix basic or extended regexes.
std::string s("a"); const boost::regex e("(.*)", boost::regex::extended); std::string result = boost::regex_replace(s, e, "$&b");
The result is "abb"
If I use gnu's sed utility (GNU sed version 4.1.2) instead I get "ab"
echo a | sed -r "s/(.*)/\1b/g"
and gnu's sed utility claims to use posix extended regex expressions when called with the -r option.
comment:4 by , 11 years ago
Resolution: | Invalid |
---|---|
Status: | closed → reopened |
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:6 by , 10 years ago
Description: | modified (diff) |
---|
This is now fixed in Trunk provided match_posix is passed to regex_replace or regex_iterator.