PythonVerbalExpressions
PythonVerbalExpressions copied to clipboard
Numbers and named groups
Added method for \d+ pattern for matching numbers
Added function group to avoid writing everywhere '(' + value + ')' and handling named groups
@andrii1812 thank you for this PR.
Since these are new features, I'd like to raise a bit of discussion at the implementation repo:
https://github.com/VerbalExpressions/implementation/issues/6
https://github.com/VerbalExpressions/implementation/issues/7
Other than that, I suppose the name argument should be present in all of the grouped methods. Now it's missing from:
anything_butmaybefindanyline_breakrange
There is a problem with re_escape decorator. If we pass name without keyword name= it will be passed into *args parameter. For example in:
VerEx().start_of_line().find('123', 'my_number').end_of_line().regex()
'my_number' will be escaped to 'my\\_number'
and error will occur:
error: bad character in group name 'my\\_number'
For what reason reason re_escape takes *args argument? It only used with only one argument, except range where escaping is not so nessesary.