Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2435)

Issue 5638046: code review 5638046: regexp: allow substitutions in Replace, ReplaceString (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by rsc
Modified:
12 years, 2 months ago
Reviewers:
CC:
r, bradfitz, r2, rog, niemeyer, golang-dev
Visibility:
Public.

Description

regexp: allow substitutions in Replace, ReplaceString Add Expand, ExpandString for access to the substitution functionality. Fixes issue 2736.

Patch Set 1 #

Patch Set 2 : diff -r 82bac8cdab6b https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 82bac8cdab6b https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 82bac8cdab6b https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 82bac8cdab6b https://go.googlecode.com/hg/ #

Total comments: 16

Patch Set 6 : diff -r 77df677f85a4 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 77df677f85a4 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 8 : diff -r a4dc8322859a https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+304 lines, -64 lines) Patch
M src/pkg/regexp/all_test.go View 1 2 3 4 5 6 7 2 chunks +86 lines, -2 lines 0 comments Download
M src/pkg/regexp/regexp.go View 1 2 3 4 5 4 chunks +218 lines, -62 lines 0 comments Download

Messages

Total messages: 20
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 2 months ago (2012-02-06 20:40:21 UTC) #1
r
I'm not sure about this. First, I can't protect a $, which means that it's ...
12 years, 2 months ago (2012-02-06 20:53:54 UTC) #2
bradfitz
I was also just wondering about a literal $. What do other languages do about ...
12 years, 2 months ago (2012-02-06 20:56:12 UTC) #3
rsc
On Mon, Feb 6, 2012 at 15:53, <r@golang.org> wrote: > First, I can't protect a ...
12 years, 2 months ago (2012-02-06 21:02:40 UTC) #4
rsc
Hello golang-dev@googlegroups.com, r@golang.org, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 2 months ago (2012-02-06 21:02:50 UTC) #5
r2
Can I have that one-liner as a predefined helper please? I'll use a security argument: ...
12 years, 2 months ago (2012-02-06 21:14:56 UTC) #6
rsc
On Mon, Feb 6, 2012 at 16:14, Rob 'Commander' Pike <r@google.com> wrote: > Can I ...
12 years, 2 months ago (2012-02-06 21:51:30 UTC) #7
r2
On 07/02/2012, at 8:51 AM, Russ Cox wrote: > On Mon, Feb 6, 2012 at ...
12 years, 2 months ago (2012-02-06 21:53:28 UTC) #8
r
http://codereview.appspot.com/5638046/diff/4004/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): http://codereview.appspot.com/5638046/diff/4004/src/pkg/regexp/all_test.go#newcode192 src/pkg/regexp/all_test.go:192: {"(?P<x>hi)|(?P<x>bye)", "hello $$x", "hi", "hello $x"}, what happens with ...
12 years, 2 months ago (2012-02-07 00:37:51 UTC) #9
rog
i vote for the use of \ as a quoting character for Expand. then QuoteMeta ...
12 years, 2 months ago (2012-02-07 12:06:23 UTC) #10
r2
On 07/02/2012, at 11:06 PM, roger peppe wrote: > i vote for the use of ...
12 years, 2 months ago (2012-02-07 12:25:28 UTC) #11
rog
On 7 February 2012 12:25, Rob 'Commander' Pike <r@google.com> wrote: > we talked about this ...
12 years, 2 months ago (2012-02-07 13:08:19 UTC) #12
rsc
The precedents are ultimately not that important, but if you want one, Python's regexp replace ...
12 years, 2 months ago (2012-02-07 14:43:22 UTC) #13
rog
On 7 February 2012 14:43, Russ Cox <rsc@golang.org> wrote: > The precedents are ultimately not ...
12 years, 2 months ago (2012-02-07 15:15:31 UTC) #14
niemeyer
That's quite useful, thanks. Make is also a precedent for the $$ as escaping. Just ...
12 years, 2 months ago (2012-02-07 16:22:36 UTC) #15
rsc
Hello golang-dev@googlegroups.com, r@golang.org, bradfitz@golang.org, r@google.com, rogpeppe@gmail.com, n13m3y3r@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 2 months ago (2012-02-07 21:29:01 UTC) #16
rsc
http://codereview.appspot.com/5638046/diff/4004/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): http://codereview.appspot.com/5638046/diff/4004/src/pkg/regexp/all_test.go#newcode192 src/pkg/regexp/all_test.go:192: {"(?P<x>hi)|(?P<x>bye)", "hello $$x", "hi", "hello $x"}, On 2012/02/07 00:37:51, ...
12 years, 2 months ago (2012-02-07 21:29:13 UTC) #17
rsc
PTAL
12 years, 2 months ago (2012-02-08 04:32:55 UTC) #18
r
LGTM http://codereview.appspot.com/5638046/diff/14001/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): http://codereview.appspot.com/5638046/diff/14001/src/pkg/regexp/all_test.go#newcode196 src/pkg/regexp/all_test.go:196: {"a+", "${oops", "aaa", "${oops"}, {"a+", "$", "aaa", "$"},
12 years, 2 months ago (2012-02-08 04:44:14 UTC) #19
rsc
12 years, 2 months ago (2012-02-08 04:46:54 UTC) #20
*** Submitted as e3cab3dc2d31 ***

regexp: allow substitutions in Replace, ReplaceString
Add Expand, ExpandString for access to the substitution functionality.

Fixes issue 2736.

R=r, bradfitz, r, rogpeppe, n13m3y3r
CC=golang-dev
http://codereview.appspot.com/5638046
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b