fork(3) download
  1. import re
  2. from pprint import pprint
  3. pattern = r"\w+(\.?\w+)*"
  4. string = """this is some test string and there are some digits as well that need to be captured as well like 1234567890 and 321 etc. But it should also select _ as well. I'm pretty sure that that RE does exactly the same.
  5. ... Oh wait, it also need to filter out the symbols like !@#$%^&*()-+=[]{}.,;:'"`| \(`.`)/
  6. ...
  7. ... I guess that's it."""
  8. pprint(re.findall(r"\w+(?:\.?\w+)*", string, re.A))
Success #stdin #stdout 0.02s 28464KB
stdin
Standard input is empty
stdout
['this',
 'is',
 'some',
 'test',
 'string',
 'and',
 'there',
 'are',
 'some',
 'digits',
 'as',
 'well',
 'that',
 'need',
 'to',
 'be',
 'captured',
 'as',
 'well',
 'like',
 '1234567890',
 'and',
 '321',
 'etc',
 'But',
 'it',
 'should',
 'also',
 'select',
 '_',
 'as',
 'well',
 'I',
 'm',
 'pretty',
 'sure',
 'that',
 'that',
 'RE',
 'does',
 'exactly',
 'the',
 'same',
 'Oh',
 'wait',
 'it',
 'also',
 'need',
 'to',
 'filter',
 'out',
 'the',
 'symbols',
 'like',
 'I',
 'guess',
 'that',
 's',
 'it']