fork download
  1. # your code goes here
  2.  
  3. import re
  4.  
  5. lines = [
  6. u'A A [A] /(slang) (Tw) to steal/',
  7. u'AA制 AA制 [A A zhi4] /to split the bill/to go Dutch/',
  8. u'AB制 AB制 [A B zhi4] /to split the bill (where the male counterpart foots the larger portion of the sum)/(theater) a system where two actors take turns in acting the main role, with one actor replacing the other if either is unavailable/',
  9. u'A咖 A咖 [A ka1] /class "A"/top grade/',
  10. u'A圈兒 A圈儿 [A quan1 r5] /at symbol, @/',
  11. u'A片 A片 [A pian4] /adult movie/pornography/'
  12. ]
  13.  
  14. regex = re.compile(r'^(.*)\s(.*)\s(\[.*\])\s(\/.*\/)')
  15.  
  16. for l in lines:
  17. g = regex.match(l)
  18. print(g.groups())
  19.  
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
(u'A', u'A', u'[A]', u'/(slang) (Tw) to steal/')
(u'AA\xe5\x88\xb6', u'AA\xe5\x88\xb6', u'[A A zhi4]', u'/to split the bill/to go Dutch/')
(u'AB\xe5\x88\xb6', u'AB\xe5\x88\xb6', u'[A B zhi4]', u'/to split the bill (where the male counterpart foots the larger portion of the sum)/(theater) a system where two actors take turns in acting the main role, with one actor replacing the other if either is unavailable/')
(u'A\xe5\x92\x96', u'A\xe5\x92\x96', u'[A ka1]', u'/class "A"/top grade/')
(u'A\xe5\x9c\x88\xe5\x85\x92', u'A\xe5\x9c\x88\xe5\x84\xbf', u'[A quan1 r5]', u'/at symbol, @/')
(u'A\xe7\x89\x87', u'A\xe7\x89\x87', u'[A pian4]', u'/adult movie/pornography/')