Skip to content

Commit

Permalink
fix: DotAll flag with group
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Sep 19, 2024
1 parent 016eb72 commit 97b9a8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions parser/regexp.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ func (self *_RegExp_parser) scanGroup() {
case '[':
self.scanBracket()
case '.':
if self.dotAll {
self.pass()
break
}
self.writeString(Re2Dot)
self.read()
default:
Expand Down
7 changes: 7 additions & 0 deletions regexp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,14 @@ func TestRegexpDotAll(t *testing.T) {
re.test("\r") && re.test("\n")
`
testScript(SCRIPT, valueTrue, t)
}

func TestRegexpDotAllInGroup(t *testing.T) {
const SCRIPT = `
var re = /(.)/s;
re.test("\r") && re.test("\n")
`
testScript(SCRIPT, valueTrue, t)
}

func TestRegexpNumSeparators(t *testing.T) {
Expand Down

0 comments on commit 97b9a8f

Please sign in to comment.