6

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
  • 49,954
  • 14
  • 144
  • 128
Kintarō
  • 2,707
  • 7
  • 40
  • 70

1 Answers1

17

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

Asclepius
  • 49,954
  • 14
  • 144
  • 128
Casimir et Hippolyte
  • 85,718
  • 5
  • 90
  • 121