Regex similar to "^(?u)\w$", but without digits?

Andreas Pfrengle a.pfrengle at gmail.com
Sun Apr 12 19:11:18 EDT 2009


On 12 Apr., 02:31, "Mark Tolonen" <metolone+gm... at gmail.com> wrote:
> "Andreas" <a.pfren... at gmail.com> wrote in message
>
> news:f953c845-3660-4bb5-8ba7-00b93989cd20 at b1g2000vbc.googlegroups.com...
>
> > Hello,
>
> > I'd like to create a regex that captures any unicode character, but
> > not the underscore and the digits 0-9. "^(?u)\w$" captures them also.
> > Is there a possibility to restrict an expression like "\w" to "\w
> > without [0-9_]"?
>
> '(?u)[^\W0-9_]' removes 0-9_ from \w.
>
> -Mark

Hello Mark,

haven't tried it yet, but it looks good!
@John: Sorry for being imprecise, I meant *letters*, not *characters*,
so requirement 2 fits my needs.

Regards,
Andreas



More information about the Python-list mailing list