On 2015-03-09 13:26, Antoon Pardon wrote:
> Op 09-03-15 om 12:17 schreef Tim Chase:
>>   (?:(?!_|\d)\w)
> 
> So if I understand correctly the following should be a regular
> expression for a python3 identifier.
> 
>   (?:(?!_|\d)\w)\w+

If you don't have to treat it as an atom, you can simplify that to
just

  (?!_|\d)\w+

which just means that the first character can't be an underscore or
digit.

Though for a Py3 identifier, the underscore is acceptable as a first
character ("__init__"), so you can simplify it even further to just

  (?!\d)\w+

-tkc



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to