Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. import re
  2.  
  3. if __name__ == '__main__':
  4.        
  5.     text = "Inbox - blablabla@gmail.com"
  6.  
  7.     match = re.findall('- ([^@]+)', text)
  8.     print '1:', match[0]
  9.    
  10.     match = re.findall('- [^@]+', text)
  11.     print '2:', match[0]
  12.    
  13.     match = re.search('- ([^@]+)', text)
  14.     print '3:', match.group(0)
  15.     print '4:', match.group(1)
  16.  
  17.     match = re.search('- [^@]+', text)
  18.     print '5:', match.group()
  19.  
  20. #---------
  21. 1: blablabla
  22. 2: - blablabla
  23. 3: - blablabla
  24. 4: blablabla
  25. 5: - blablabla
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement