From bfa0545fdcf5ec288af8428d94b3f3e7b5026263 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 23 Feb 2022 17:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DWAF=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D=E6=97=B6=E5=8F=AF=E8=83=BD=E4=BC=9A=E4=BD=BF=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=B4=A9=E6=BA=83=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/re/regexp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/re/regexp.go b/internal/re/regexp.go index cf978d5..dad5079 100644 --- a/internal/re/regexp.go +++ b/internal/re/regexp.go @@ -211,6 +211,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) { } if keyword[index-1] != '\\' { if r == '{' && (braceZero.MatchString(string(keyword[index:])) || braceZero2.MatchString(string(keyword[index:]))) { // r {0, ...} + if len(result) == 0 { + return nil + } return result[:len(result)-1] } @@ -221,6 +224,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) { if index == 0 { return nil } + if len(result) == 0 { + return nil + } return result[:len(result)-1] } if r == '\\' || r == '\b' {