-1

I need a regex to match the groups of characters in a string. For example this is-a@beautiful^day. Should result in the following list: this, is, a, beautiful, day. As a mention I don't know how long the string is or by what characters the words are separated.

Any ideas? I have no clue how to build a regex for this.

jojuk
  • 127
  • 1
  • 3
  • 14

1 Answers1

1

If you want find all groups of letters:

import re

string = "this is-a@beautiful^day"
list = re.findall(r'[A-Za-z]+', string)
print list

['this', 'is', 'a', 'beautiful', 'day']
Dmitry
  • 2,026
  • 1
  • 18
  • 22