Check both beginning-of-text conditions in Regexp
This commit is contained in:
parent
6919e604ad
commit
3e178e74fd
@ -41,7 +41,7 @@ func (rr *RuneReader) Cursor() cursor.Cursor[byte] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Regexp(str string) gigaparsec.Parser[byte, []byte] {
|
func Regexp(str string) gigaparsec.Parser[byte, []byte] {
|
||||||
if !strings.HasPrefix(str, "^") {
|
if !strings.HasPrefix(str, "^") && !strings.HasPrefix(str, `\A`) {
|
||||||
str = "^" + str
|
str = "^" + str
|
||||||
}
|
}
|
||||||
re := regexp.MustCompile(str)
|
re := regexp.MustCompile(str)
|
||||||
|
Loading…
Reference in New Issue
Block a user