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 1798ea5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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
8 changes: 7 additions & 1 deletion regexp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,15 @@ 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) {
const SCRIPT = `
const re = /(?<=a)\u{65}_/u;
Expand Down

0 comments on commit 1798ea5

Please sign in to comment.