Definition:
Back to the main index of this glossary
>>> import re
>>> y = re.split('(.,\s.+)', 'Home is the sailor, home from sea, and the hunter home from the hill.')
>>> print y
['Home is the sailo', 'r, home from sea, and the hunter home from the hill.', '']
>>> y = re.split('(.,\s.+?)', 'Home is the sailor, home from sea, and the hunter home from the hill.')
>>> print y
['Home is the sailo', 'r, h', 'ome from se', 'a, a', 'nd the hunter home from the hill.']
>>>
>>> y = re.split('(<.+>)', '<a href="http://www.some-url.com">some hyperlink</a>')
>>> print y
['', '<a href="http://www.some-url.com">some hyperlink</a>', '']
>>> y = re.split('(<.+?>)', '<a href="http://www.some-url.com">some hyperlink</a>')
>>> print y
['', '<a href="http://www.some-url.com">', 'some hyperlink', '</a>', '']
Back to the main index of this glossary
