Closed monkeyWie closed 4 months ago
My understanding is that dotAll is a synonym for “regexp2.Singleline” option or (?s)
Ya, but when I use regexp2.ECMAScript | regexp2.Singleline
, it not work.
Using regexp2.Singleline
alone is fine.
What exactly doesn't work? I'll need a regex, options, match text, and what you expected the match to be. I suggest the form of a unit test.
Thanks for the quick reply, below is the unit test code:
// It works fine
func TestRegexpSingleline(t *testing.T) {
re := regexp2.MustCompile(`.`, regexp2.Singleline)
if isMatch, _ := re.MatchString("\n"); !isMatch {
t.Fatal("Expected match")
}
}
// It not work
func TestRegexpECMAScriptWithSingleline(t *testing.T) {
re := regexp2.MustCompile(`.`, regexp2.ECMAScript | regexp2.Singleline)
if isMatch, _ := re.MatchString("\n"); !isMatch {
t.Fatal("Expected match")
}
}
This is now fixed -- the regex parser's if/elseif block was backwards for dot. Singleline should always include all chars and EcmaScript only has a different set for dot if Singleline isn't set.
Thanks for the report!
I just upgraded to the latest version but still have problems. It seems that the latest submit only added a unit test
Well that's embarrassing. My git add *.go
missed that the change was in the syntax
folder. Code now shipped.
Thanks, it work well now!
Thank you for this great project, but it seems that the
dotAll
option is not supported now, is there any way to achieve it?