// through file, but that seems like overkill.
return 0, 0, os.NewError("reverse search not implemented")
}
- m := re.Execute(data[hi:])
+ m := re.FindIndex(data[hi:])
if len(m) > 0 {
m[0] += hi
m[1] += hi
} else if hi > 0 {
// No match. Wrap to beginning of data.
- m = re.Execute(data)
+ m = re.FindIndex(data)
}
if len(m) == 0 {
return 0, 0, os.NewError("no match for " + pattern)
func extractString(src []byte, rx *regexp.Regexp) (s string) {
- m := rx.Execute(src)
+ m := rx.Find(src)
if len(m) >= 4 {
s = strings.TrimSpace(string(src[m[2]:m[3]]))
}
if strings.Index(pkg, "..") >= 0 {
return "", os.ErrorString("invalid path (contains ..)")
}
- if m := bitbucket.MatchStrings(pkg); m != nil {
+ if m := bitbucket.FindStringSubmatch(pkg); m != nil {
if err := vcsCheckout(&hg, root+m[1], "http://"+m[1], m[1]); err != nil {
return "", err
}
return root + pkg, nil
}
- if m := googlecode.MatchStrings(pkg); m != nil {
+ if m := googlecode.FindStringSubmatch(pkg); m != nil {
var v *vcs
switch m[2] {
case "hg":
}
return root + pkg, nil
}
- if m := github.MatchStrings(pkg); m != nil {
+ if m := github.FindStringSubmatch(pkg); m != nil {
if strings.HasSuffix(m[1], ".git") {
return "", os.ErrorString("repository " + pkg + " should not have .git suffix")
}
}
return root + pkg, nil
}
- if m := launchpad.MatchStrings(pkg); m != nil {
+ if m := launchpad.FindStringSubmatch(pkg); m != nil {
// Either lp.net/<project>[/<series>[/<path>]]
// or lp.net/~<user or team>/<project>/<branch>[/<path>]
if err := vcsCheckout(&bzr, root+m[1], "https://"+m[1], m[1]); err != nil {
// and '' into ”).
func emphasize(w io.Writer, line []byte, words map[string]string, nice bool) {
for {
- m := matchRx.Execute(line)
- if len(m) == 0 {
+ m := matchRx.Find(line)
+ if m == nil {
break
}
// m >= 6 (two parenthesized sub-regexps in matchRx, 1st one is identRx)
// collect BUG(...) comments
for _, c := range src.Comments {
text := c.List[0].Text
- if m := bug_markers.Execute(text); len(m) > 0 {
+ if m := bug_markers.Find(text); m != nil {
// found a BUG comment; maybe empty
if btxt := text[m[1]:]; bug_content.Match(btxt) {
// non-empty BUG comment; collect comment without BUG prefix
if line == "\n" || line == "\r\n" {
return nil
}
- if matches := headerRegexp.MatchStrings(line); len(matches) == 3 {
+ if matches := headerRegexp.FindStringSubmatch(line); len(matches) == 3 {
key := matches[1]
value := matches[2]
// TODO: canonicalize headers ala http.Request.Header?
re := regexp.MustCompile(pat)
n := 0
for {
- e := re.Execute(bytes)
- if len(e) == 0 {
+ e := re.FindIndex(bytes)
+ if e == nil {
break
}
n++
re := regexp.MustCompile(pat)
n := 0
for {
- e := re.Execute(bytes)
+ e := re.FindIndex(bytes)
if len(e) == 0 {
break
}