Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Python regex matches all alphabet characters but no numbers? [unicode aware] [duplicate]

Tags:

python

regex

I'm looking for the equivalent of [\w]&&[^\d] (Of course && is not a regex operator). The regex needs to match ONLY words made up of UTF8 "alphabet" characters. Does anyone have any ideas?

like image 993
Thomas Avatar asked Apr 03 '12 06:04

Thomas


People also ask

Which below regex is applicable for alphabets?

[A-Za-z] will match all the alphabets (both lowercase and uppercase).

How do you match letters in regex?

To match a character having special meaning in regex, you need to use a escape sequence prefix with a backslash ( \ ). E.g., \. matches "." ; regex \+ matches "+" ; and regex \( matches "(" .

Which regex matches one or more digits Python?

You can use out\dmf\d+ , or, if you want to match only 1 or 2 digits at the end, out\dmf\d{1,2} .

What will the $' regular expression match in Python?

match() function of re in Python will search the regular expression pattern and return the first occurrence. The Python RegEx Match method checks for a match only at the beginning of the string. So, if a match is found in the first line, it returns the match object.


1 Answers

regex supports Unicode properties, which means that you can use \p{L} with it.

like image 173
Ignacio Vazquez-Abrams Avatar answered Sep 28 '22 09:09

Ignacio Vazquez-Abrams