Skip to content

Commit

Permalink
RE2 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Oct 2, 2021
1 parent e5d5c75 commit ed8b77c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion std.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package regexp2

func CompileStd(s string) (*Regexp, error) {
return Compile(s, Multiline)
return Compile(s, RE2)
}

func MustCompileStd(s string) *Regexp {
Expand Down
14 changes: 14 additions & 0 deletions std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ func TestFindAllStringSubmatchIndex(t *testing.T) {
if !reflect.DeepEqual(a1, a2) {
t.Fatalf("Failed: %v, %v", a1, a2)
}

/* FIXME: There's a disconnect between rune/byte offets
re1 = regexp.MustCompile(`(?m)(?:(?P<Smart3>[”“]))`)
re2 = MustCompileStd(`(?m)(?:(?P<Smart3>[”“]))`)
s := `(smart or “curly” quotes).`
a1 = re1.FindAllStringSubmatchIndex(s, -1)
a2 = re2.FindAllStringSubmatchIndex(s, -1)
if !reflect.DeepEqual(a1, a2) {
t.Fatalf("Failed: %v, %v", a1, a2)
}*/
}

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

0 comments on commit ed8b77c

Please sign in to comment.