Throw error if \B is used in character class
This commit is contained in:
@@ -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')
|
||||
|
Reference in New Issue
Block a user