t460.py 570 B

12345678910111213141516
  1. import re
  2. print re.split("\W+", "Words, words, words.")
  3. print re.split("(\W+)", "Words, words, words.")
  4. print re.split("\W+", "Words, words, words.", 1)
  5. print re.split('[a-f]+', '0a3B9', 0, re.IGNORECASE)
  6. print re.split("(\W+)", '...words, words...')
  7. print re.split('x*', 'foo')
  8. #print re.split("(?m)^$", "foo\n\nbar\n")
  9. print re.findall('\w+', "Words, words, words.")
  10. print re.findall('(abc)(def)', 'abcdef')
  11. print re.findall('(abc)(def)', 'abcdefabcdefjaabcdef3sabc')
  12. print re.findall('(abc)', 'abcdef')
  13. print re.findall('(abc)|(def)', 'abcdefabcdefjaabcdef3sabc')