Regex similar to "^(?u)\w$", but without digits?
sjmachin at lexicon.net
Sun Apr 12 02:08:08 CEST 2009
On Apr 12, 4:29 am, Andreas <a.pfren... at gmail.com> wrote:
> 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_]"?
The two requirements are not the same.
R1: [^0-9_] matches any character except the underscore and the digits
R2: To match "like \w except for underscore and digits 0-9", find
"negative lookbehind assertion" in the re docs.
I've omitted the ^, $ and (?u) because the above advice is general.
More information about the Python-list