Skip to content

regexp: Regex returns true for strings that it should not match #23808

@arunvm123

Description

@arunvm123

Please answer these questions before submitting your issue. Thanks!

What did you do?

Tried to construct a regex pattern that matches whitespaces between words, so as to validate names. The pattern should match only letters and whitespaces but seems to return true for other characters as well.

https://play.golang.org/p/3LoX8_haM_6

What did you expect to see?

The program to return false

What did you see instead?

The program returned true

Does this issue reproduce with the latest release (go1.9.4)?

System details

go version go1.9 linux/amd64
GOARCH="amd64"
GOBIN="/home/arunvm/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/arunvm/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build814277393=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version go1.9 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.9
uname -sr: Linux 4.11.12-100.fc24.x86_64
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 24 (Twenty Four)
Release:	24
Codename:	TwentyFour
/lib64/libc.so.6: GNU C Library (GNU libc) stable release version 2.23, by Roland McGrath et al.
gdb --version: GNU gdb (GDB) Fedora 7.11.1-86.fc24

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