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

Regex not compiling #540

Closed
gopherbot opened this issue Jan 17, 2010 · 3 comments
Closed

Regex not compiling #540

gopherbot opened this issue Jan 17, 2010 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by linuxhacker100:

I am working with NZB files. The regex is supposed to parse a subject line.

What steps will reproduce the problem?

Add this line to your program. p := regexp.MustCompile(`"(.*?)".*? yEnc
\((.*?)\)`)

What is the expected output? What do you see instead?

When I run the program I get:

user@host:~/sandbox/nzb$ 6g regexTest.go && 6l regexTest.6
user@host:~/sandbox/nzb$ ./6.out
regexp: compiling " "(.*?)".*? yEnc \((.*?)\) ":  unmatched '('
panic PC=0x7fe8404b5f28
regexp·MustCompile+0xbb /home/stephen/sandbox/go/src/pkg/regexp/regexp.go:677
        regexp·MustCompile(0x4600f8, 0x0, 0x19, 0x0, 0x1, ...)
main·main+0x23 /home/stephen/sandbox/nzb/regexTest.go:7
        main·main()
mainstart+0xf /home/stephen/sandbox/go/src/pkg/runtime/amd64/asm.s:54
        mainstart()
goexit /home/stephen/sandbox/go/src/pkg/runtime/proc.c:140
        goexit()

What is your $GOOS?  $GOARCH?
linux amd64

Which revision are you using?  (hg identify)
7df3be16abbf tip

Please provide any additional information below.

I am attaching a complete test program so you can see the error.

Attachments:

  1. regexTest.go (225 bytes)
@peterGo
Copy link
Contributor

peterGo commented Jan 17, 2010

Comment 1:

Isn't this related to issue #484: Regexp package : panic on repeated closure. Aren't
you using non-greedy operators like '*?'?

@rsc
Copy link
Contributor

rsc commented Jan 17, 2010

Comment 2:

Status changed to Duplicate.

Merged into issue #484.

@gopherbot
Copy link
Contributor Author

Comment 3 by linuxhacker100:

I found a work around. I hope that you extend the regexp package soon.
p := regexp.MustCompile(`"([^"]*)"[^(]*\(1/([^)]*)\)`)

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants