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

Regexp package : panic on repeated closure #484

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

Regexp package : panic on repeated closure #484

gopherbot opened this issue Jan 1, 2010 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by sebastien.geffroy:

What steps will reproduce the problem?
re := regexp.MustCompile("beginTag(?:[\n\r]|.)+?endTag")

What is the expected output? What do you see instead?
this example works great in python

regexp: compiling " begin(?:[
]|.)+?end ":  repeated closure (**, ++, etc.)
panic PC=0x2bcd98
regexp·MustCompile+0xbb /Users/seb/go/src/pkg/regexp/regexp.go:677
    regexp·MustCompile(0x749a0, 0x0, 0x14, 0x0, 0x18, ...)
tpl·*Template·parseBlock+0x30 /Users/seb/Documents/Code Source/Go/tpl/tpl.go:90
    tpl·*Template·parseBlock(0x2b57a0, 0x0, 0x2ba3f0, 0x0, 0x87, ...)
tpl·*Template·renderExtends+0xb0 /Users/seb/Documents/Code Source/Go/tpl/tpl.go:79
    tpl·*Template·renderExtends(0x2b57a0, 0x0, 0x2bcf10, 0x0)
tpl·*Template·Render+0x2a /Users/seb/Documents/Code Source/Go/tpl/tpl.go:45
    tpl·*Template·Render(0x2b57a0, 0x0, 0x2ca4d0, 0x0, 0x4, ...)
tpl·TestTpl+0x103 /Users/seb/Documents/Code Source/Go/tpl/tpl_test.go:12
    tpl·TestTpl()
testing·tRunner+0x22 /Users/seb/go/src/pkg/testing/testing.go:132
    testing·tRunner(0x2b7140, 0x0, 0x78ce0, 0x0)
goexit /Users/seb/go/src/pkg/runtime/proc.c:136
    goexit()
0x2b7140 unknown pc

goroutine 1 [4]:
gosched+0x34 /Users/seb/go/src/pkg/runtime/proc.c:522
    gosched()
chanrecv+0x38c /Users/seb/go/src/pkg/runtime/chan.c:320
    chanrecv(0x2d81e0, 0x0, 0x2bbf68, 0x0, 0x0, ...)
runtime·chanrecv1+0x50 /Users/seb/go/src/pkg/runtime/chan.c:417
    runtime·chanrecv1(0x2d81e0, 0x0)
testing·Main+0x263 /Users/seb/go/src/pkg/testing/testing.go:159
    testing·Main(0x78ce0, 0x0)
main·main+0x23 /Users/seb/Documents/Code Source/Go/tpl/_testmain.go:14
    main·main()
mainstart+0xf /Users/seb/go/src/pkg/runtime/amd64/asm.s:54
    mainstart()
goexit /Users/seb/go/src/pkg/runtime/proc.c:136
    goexit()
make: *** [test] Error 2

What is your $GOOS?  $GOARCH?
DOOS=darwin
DOARCH=amd64


Which revision are you using?  (hg identify)
a6fcf4303b0a release/release.2009-12-22

Please provide any additional information below.
@peterGo
Copy link
Contributor

peterGo commented Jan 2, 2010

Comment 1:

There are many dialects of regular expressions. Go's regexp package implements a
simple regular expression library.
http://golang.org/pkg/regexp/
The error message complains about 'repeated closure (**, ++, etc.)'. Isn't your use
of '+?' a repeated closure?

@rsc
Copy link
Contributor

rsc commented Jan 3, 2010

Comment 2:

Package regexp does not support non-capturing parens (?:...)
nor does it support "non-greedy" operators like +?
Eventually there will be a replacement that does all these things
but for now, this is working as intended.

Owner changed to r...@golang.org.

Status changed to WorkingAsIntended.

@rsc
Copy link
Contributor

rsc commented Jan 17, 2010

Comment 3:

Issue #540 has been merged into this issue.

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