PythonVerbalExpressions icon indicating copy to clipboard operation
PythonVerbalExpressions copied to clipboard

Numbers and named groups

Open andrii1812 opened this issue 9 years ago • 2 comments

Added method for \d+ pattern for matching numbers Added function group to avoid writing everywhere '(' + value + ')' and handling named groups

andrii1812 avatar Jan 02 '16 20:01 andrii1812

@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_but
  • maybe
  • find
  • any
  • line_break
  • range

jehna avatar Jan 03 '16 11:01 jehna

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.

andrii1812 avatar Jan 03 '16 12:01 andrii1812