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

Issue 6846048: code review 6846048: regexp: add Split() method (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 7 months ago by rick
Modified:
9 years, 7 months ago
Reviewers:
CC:
remyoudompheng, r, rsc, golang-dev
Visibility:
Public.

Description

regexp: add Split() method As discussed in issue 2672 and on golang-nuts, this CL adds a Split() method to regexp. It is based on returning the "opposite" of FindAllString() so that the returned substrings are everything not matched by the expression. See: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/xodBZh9Lh2E Fixes issue 2762.

Patch Set 1 #

Patch Set 2 : diff -r d465db6441bc https://code.google.com/p/go #

Patch Set 3 : diff -r d465db6441bc https://code.google.com/p/go #

Patch Set 4 : diff -r d465db6441bc https://code.google.com/p/go #

Total comments: 5

Patch Set 5 : diff -r d465db6441bc https://code.google.com/p/go #

Total comments: 5

Patch Set 6 : diff -r d465db6441bc https://code.google.com/p/go #

Total comments: 2

Patch Set 7 : diff -r d465db6441bc https://code.google.com/p/go #

Total comments: 4

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

Patch Set 9 : diff -r d465db6441bc https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -0 lines) Patch
M src/pkg/regexp/all_test.go View 1 2 3 4 5 6 7 2 chunks +54 lines, -0 lines 0 comments Download
M src/pkg/regexp/regexp.go View 1 2 3 4 5 6 7 8 1 chunk +48 lines, -0 lines 0 comments Download

Messages

Total messages: 23
rick
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
9 years, 7 months ago (2012-11-13 23:24:20 UTC) #1
rick
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-13 23:25:16 UTC) #2
remyoudompheng
http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/regexp.go File src/pkg/regexp/regexp.go (right): http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/regexp.go#newcode1054 src/pkg/regexp/regexp.go:1054: // indicates the maximum number of splits to perform ...
9 years, 7 months ago (2012-11-13 23:47:08 UTC) #3
r
http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/all_test.go#newcode426 src/pkg/regexp/all_test.go:426: {"foo:and:bar", ":", -1, []string{"foo", "and", "bar"}}, always test empty ...
9 years, 7 months ago (2012-11-13 23:52:36 UTC) #4
rick
Hello golang-dev@googlegroups.com, remyoudompheng@gmail.com, r@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-14 01:07:56 UTC) #5
rick
On 2012/11/13 23:52:36, r wrote: > http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/all_test.go > File src/pkg/regexp/all_test.go (right): > > http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/all_test.go#newcode426 > ...
9 years, 7 months ago (2012-11-14 01:08:52 UTC) #6
rick
On 2012/11/13 23:47:08, remyoudompheng wrote: > http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/regexp.go > File src/pkg/regexp/regexp.go (right): > > http://codereview.appspot.com/6846048/diff/7001/src/pkg/regexp/regexp.go#newcode1054 > ...
9 years, 7 months ago (2012-11-14 01:10:12 UTC) #7
rick
PTAL
9 years, 7 months ago (2012-11-19 20:30:55 UTC) #8
r
https://codereview.appspot.com/6846048/diff/8003/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): https://codereview.appspot.com/6846048/diff/8003/src/pkg/regexp/all_test.go#newcode450 src/pkg/regexp/all_test.go:450: t.Errorf("Split: test %d: expression doesn't compile: %s; error: %s", ...
9 years, 7 months ago (2012-11-19 20:39:47 UTC) #9
rsc
https://codereview.appspot.com/6846048/diff/8003/src/pkg/regexp/regexp.go File src/pkg/regexp/regexp.go (right): https://codereview.appspot.com/6846048/diff/8003/src/pkg/regexp/regexp.go#newcode1061 src/pkg/regexp/regexp.go:1061: // split against + 1. On 2012/11/19 20:39:47, r ...
9 years, 7 months ago (2012-11-19 20:41:06 UTC) #10
rick
Hello remyoudompheng@gmail.com, r@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-20 00:41:42 UTC) #11
rick
PTAL Thanks for being patient with me on this CL. I am new to this ...
9 years, 7 months ago (2012-11-20 00:43:03 UTC) #12
r
it's nearly there https://codereview.appspot.com/6846048/diff/2002/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): https://codereview.appspot.com/6846048/diff/2002/src/pkg/regexp/all_test.go#newcode459 src/pkg/regexp/all_test.go:459: t.Errorf("#%d: %q: split = %#v; want ...
9 years, 7 months ago (2012-11-20 01:05:27 UTC) #13
rick
Hello remyoudompheng@gmail.com, r@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-20 02:31:45 UTC) #14
rick
PTAL
9 years, 7 months ago (2012-11-21 20:26:18 UTC) #15
rsc
I think if you make these test changes you will find that the matching loop ...
9 years, 7 months ago (2012-11-26 15:16:49 UTC) #16
rick
On Monday, November 26, 2012 10:16:53 AM UTC-5, rsc wrote: > > I think if ...
9 years, 7 months ago (2012-11-26 16:16:58 UTC) #17
rsc
I think if you have a literal string s and you use strings.SplitN, and then ...
9 years, 7 months ago (2012-11-26 16:31:36 UTC) #18
rick
Hello remyoudompheng@gmail.com, r@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-27 01:30:15 UTC) #19
rick
Hello remyoudompheng@gmail.com, r@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
9 years, 7 months ago (2012-11-27 01:34:02 UTC) #20
rick
PTAL. I used FindAllStringIndex(s, n) instead of FindAllStringIndex(s, n-1) since sometimes a regular expression will ...
9 years, 7 months ago (2012-11-27 01:39:00 UTC) #21
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=efc46b2230aa *** regexp: add Split As discussed in issue 2672 and on ...
9 years, 7 months ago (2012-11-27 17:58:31 UTC) #22
rsc
9 years, 7 months ago (2012-11-27 17:58:33 UTC) #23
LGTM
Sign in to reply to this message.

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