Skip to content

regexp: LiteralPrefix returns complete=true incorrectly #11175

Description

@dvyukov

The following program fails:

package main

import "regexp"

func main() {
    re := regexp.MustCompile("^0^000000$")
    prefix, complete := re.LiteralPrefix()
    if complete && !re.MatchString(prefix) {
        panic("prefix:" + prefix)
    }
}
panic: prefix:0

If LiteralPrefix return complete==true, the re must match the prefix.

go version devel +b0532a9 Mon Jun 8 05:13:15 2015 +0000 linux/amd64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions