Message234677
# Python 3.3.1 (default, Sep 25 2013, 19:30:50)
# Linux 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:25:33 UTC 2013 i686 i686 i686 GNU/Linux
import re
splitter = re.compile( r'(\s*[+/&;,]\s*)|(\s+and\s+)' )
ll = splitter.split( 'Dave & Sam, Jane and Zoe' )
print(repr(ll))
print( 'Try again with revised RegEx' )
splitter = re.compile( r'(?:(?:\s*[+/&;,]\s*)|(?:\s+and\s+))' )
ll = splitter.split( 'Dave & Sam, Jane and Zoe' )
print(repr(ll))
Results:
['Dave', ' & ', None, 'Sam', ', ', None, 'Jane', None, ' and ', 'Zoe']
Try again with revised RegEx
['Dave', 'Sam', 'Jane', 'Zoe'] |
|
Date |
User |
Action |
Args |
2015-01-25 17:31:37 | dnotmanj | set | recipients:
+ dnotmanj, ezio.melotti, mrabarnett |
2015-01-25 17:31:37 | dnotmanj | set | messageid: <1422207097.55.0.514125060003.issue23318@psf.upfronthosting.co.za> |
2015-01-25 17:31:37 | dnotmanj | link | issue23318 messages |
2015-01-25 17:31:37 | dnotmanj | create | |
|