Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple matches behaviour #1

Open
WindzCUHK opened this issue Mar 12, 2020 · 0 comments
Open

Multiple matches behaviour #1

WindzCUHK opened this issue Mar 12, 2020 · 0 comments

Comments

@WindzCUHK
Copy link

WindzCUHK commented Mar 12, 2020

For string b\ar should match pattern b\\ar other than b\\*ar (more specific pattern)?
Or, matches to pattern with max. index on multiple matches?

	patterns := []struct {
		s string
		i interface{}
	}{
		{"*", 0},
		{`b\ar`, 8},
		{`b\\ar`, 9},
		{`b\\*ar`, 10},
		{`b\\\*ar`, 11},
		{`b\\\\*ar`, 12},
	}
	data := []struct {
		s string
		v interface{}
	}{
		{`bar`, 8},
		{`b\ar`, 9},
		{`b\*ar`, 11},
		{`b\**ar`, 10},
		{`b\\*ar`, 12},
	}
$ go test ./...
--- FAIL: TestPattern (0.00s)
    all_test.go:43: 
        	Error Trace:	all_test.go:43
        	Error:      	Not equal: 
        	            	expected: 9
        	            	actual  : 10
        	Test:       	TestPattern
FAIL
FAIL	github.com/fanyang01/radix	0.055s
FAIL
@WindzCUHK WindzCUHK changed the title Escape is not correct Multiple matches behaviour Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant