diff --git a/regex/postfixNode.go b/regex/postfixNode.go index 355bc6c..a6a3cd8 100644 --- a/regex/postfixNode.go +++ b/regex/postfixNode.go @@ -95,6 +95,9 @@ func newEscapedNode(c rune, inCharClass bool) (postfixNode, error) { toReturn.nodetype = assertionNode toReturn.contents = append(toReturn.contents, c) } + if c == 'B' && inCharClass { // Invalid + return postfixNode{}, fmt.Errorf("word boundaries are not allowed in character class") + } case 'n': // Newline character toReturn.nodetype = characterNode toReturn.contents = append(toReturn.contents, '\n')