7

I use the regular expression which matches both alphabets and digits.

prog = re.compile(r'^\w+$')

How can I just match ASCII alphabets only?

Asclepius
  • 57,944
  • 17
  • 167
  • 143
Kintarō
  • 2,947
  • 10
  • 48
  • 75

1 Answers1

17

You must replace \w by [a-zA-Z]

Asclepius
  • 57,944
  • 17
  • 167
  • 143
Casimir et Hippolyte
  • 88,009
  • 5
  • 94
  • 125