diff --git a/bytes/regexp.go b/bytes/regexp.go index 45a558a..a8b14c4 100644 --- a/bytes/regexp.go +++ b/bytes/regexp.go @@ -41,7 +41,7 @@ func (rr *RuneReader) Cursor() cursor.Cursor[byte] { } func Regexp(str string) gigaparsec.Parser[byte, []byte] { - if !strings.HasPrefix(str, "^") { + if !strings.HasPrefix(str, "^") && !strings.HasPrefix(str, `\A`) { str = "^" + str } re := regexp.MustCompile(str)