Named regexp variables, an extension proposal.

Paddy paddy3118 at netscape.net
Sun May 14 14:29:57 EDT 2006


I have another use case.
If you want to match a comma separated list of words you end up writing
what constitutes a word twice, i.e:
  r"\w+[,\w+]"
As what constitues a word gets longer, you have to repeat a longer RE
fragment so the fact that it is a match of a comma separated list is
lost, e.g:
  r"[a-zA-Z_]\w+[,[a-zA-Z_]\w+]"

- Paddy.




More information about the Python-list mailing list