-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Description
I am trying to build some sophisticated template and here's one of my RE patterns
Value TYPE ([a-z\s]+)
Value NEXTHOP ((?:\d{1,3}\.){3}\d{1,3})
Value INTERFACE ([A-Za-z0-9\.\/-]+)
^\s+${TYPE}(?<=drop|no route|receive|multicast)$$
^\s+${TYPE}(?<=nexthop)\s+${NEXTHOP}\s+${INTERFACE}
^\s+recursive\s+via\s+${NEXTHOP}
^\s+${TYPE}(?<=receive|attached)\s+(?:for|to)\s+${INTERFACE}
This is absolutely valid regexp, I've tested it here: https://regex101.com/
However, when I process the file using this TextFSM template, I get this
textfsm.parser.TextFSMTemplateError:
Invalid regular expression: '^\s+(?P<TYPE>[a-z\s]+)(?<=drop|no route|receive|multicast)$'.
Does it mean lookbehind logic is not supported?
Basically, I'd like to be able to capture TYPE value if it's drop, no route, receive or multicast in one pattern, but then capture TYPE in a different line if it's nexthop
If this is not supported, I will have to define all these keywords in TYPE's pattern and it won't be as universal as my approach.
Regards
Metadata
Metadata
Assignees
Labels
No labels