diff --git a/regex/compile.go b/regex/compile.go index b40c371..1068966 100644 --- a/regex/compile.go +++ b/regex/compile.go @@ -1059,8 +1059,8 @@ func thompson(re []postfixNode) (Reg, error) { // '|a' // '^a|' // '^|a' - s1, err1 := pop(&nfa) - s2, err2 := pop(&nfa) + s2, err1 := pop(&nfa) + s1, err2 := pop(&nfa) if err2 != nil || (s2.groupBegin && len(s2.transitions) == 0) { // Doesn't exist, or its just an LPAREN if err2 == nil { // Roundabout way of saying that this node existed, but it was an LPAREN, so we append it back nfa = append(nfa, s2)