Skip to content

False matches in regexp package - ^/$ matches "/css", yielding "s" #308

@gopherbot

Description

@gopherbot

by suraci.alex:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Compile regexp `^/$`.
2. Dump regexp.MatchStrings("/css");
3.

What is the expected output? What do you see instead?
[]string{} - that is, no match.

Instead, it's matching the last character, returning:
[]string{"s"}


What is your $GOOS?  $GOARCH?
src $ env | grep "^GO"
GOBIN=/home/alex/bin
GOARCH=amd64
GOROOT=/home/alex/go
GOOS=linux

Which revision are you using?  (hg identify)
src $ hg identify
2f32e74ab96e tip

Please provide any additional information below.
It didn't do this before (I have it working on 751eaa8f96f7), I'm guessing 
the recent regexps overhaul caused it but I really don't know. Tried 
changing the match to `^\/$`, since / is often a special regexp character, 
but that led to the regexp not compiling at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions