google / textfsm

Python module for parsing semi-structured text into python tables.
Apache License 2.0
1.11k stars 171 forks source link

Fix regex parsing for parentheses #99

Closed nicolascanceill-Optiver closed 2 years ago

nicolascanceill-Optiver commented 2 years ago

This fixes the check for values' regexes to be enclosed within parentheses

(I am contributing this patch as an employee of Optiver, ready to sign a CLA)

Issue

Background

Each value definition requires a valid regex which, as mentioned in the wiki, must be enclosed within parentheses. It is easy to check whether the regex starts with ( and ends with a non-escaped ) but the hard part is making sure that the ending ) matches the starting (.

This used to be enforced by:

This was not a correct check, so google#68 changed it to:

This is still not a correct check:

Proposed fix

nicolascanceill-Optiver commented 2 years ago

The CLA is now signed but I cannot re-run the check.

Trying to force a re-run by closing and reopening the PR.

harro commented 2 years ago

Thanks for the fix.