Issue 78 in re2: re2.h Replace function description incorrect

25 views
Skip to first unread message

r...@googlecode.com

unread,
Apr 8, 2013, 1:29:36 PM4/8/13
to re2...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 78 by theperma...@gmail.com: re2.h Replace function description
incorrect
http://code.google.com/p/re2/issues/detail?id=78

What steps will reproduce the problem?
The re2.h header file's Replace() function description is incorrect.
Backreferences are not supported, per documentation elsewhere on site.
However, the description is nearly identical to the function of the same
name in the pcre.h header file.

1. Backrefs don't work:
std::string str = "testing1234regex"
RE2::Replace(&str, ".*(\\d+).*", "\1");
std::cout << "str='" << str << "' " << "\n";

What is the expected output? What do you see instead?
Expected: "1234"
Observed: " "

What version of the product are you using? On what operating system?
Build 20130115
OSX 10.7

Please provide any additional information below.
NOTE: If you have a suggested patch, please see
http://code.google.com/p/re2/wiki/Contribute
for information about sending it in for review. Thanks.

Just wanting to get the description changed so someone like me doesn't get
confused and frustrated by thinking backreferences really are supported.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

r...@googlecode.com

unread,
Apr 8, 2013, 1:32:37 PM4/8/13
to re2...@googlegroups.com

Comment #1 on issue 78 by theperma...@gmail.com: re2.h Replace function
description incorrect
http://code.google.com/p/re2/issues/detail?id=78

Above, I meant Apple's pcrecpp.h, not pcre.h
See http://opensource.apple.com/source/pcre/pcre-4.2/pcre/pcrecpp.h

r...@googlecode.com

unread,
Jan 9, 2014, 10:22:37 PM1/9/14
to re2...@googlegroups.com
Updates:
Status: WorkingAsIntended

Comment #2 on issue 78 by r...@golang.org: re2.h Replace function
description incorrect
http://code.google.com/p/re2/issues/detail?id=78

See note at bottom of https://code.google.com/p/re2/.
Submatch references are fine in replacement strings.
I think the problem is that you've written \1 but need to write \\1 to get
past the C string conventions.
Sorry for the long delayed reply.
Reply all
Reply to author
Forward
0 new messages