Added support for start-of-input (\A) and end-of-input (\Z) assertions
This commit is contained in:
@@ -98,6 +98,13 @@ func newEscapedNode(c rune, inCharClass bool) (postfixNode, error) {
|
||||
if c == 'B' && inCharClass { // Invalid
|
||||
return postfixNode{}, fmt.Errorf("word boundaries are not allowed in character class")
|
||||
}
|
||||
case 'A', 'Z': // A is start of input, Z is end of input (regardless of RE_MULTILINE)
|
||||
if inCharClass {
|
||||
return postfixNode{}, fmt.Errorf("input boundaries are not allowed in character class")
|
||||
} else {
|
||||
toReturn.nodetype = assertionNode
|
||||
toReturn.contents = append(toReturn.contents, c)
|
||||
}
|
||||
case 'n': // Newline character
|
||||
toReturn.nodetype = characterNode
|
||||
toReturn.contents = append(toReturn.contents, '\n')
|
||||
|
Reference in New Issue
Block a user