Python split string ekspresi reguler
import re
s_nums = 'one1two22three333four'
print(re.split('\d+', s_nums))
# ['one', 'two', 'three', 'four']
SemicolonForgotten
import re
s_nums = 'one1two22three333four'
print(re.split('\d+', s_nums))
# ['one', 'two', 'three', 'four']
import re
# Compile a regular expression pattern into a regular expression object, which can be used for matching using its match(), search() and other methods, described below.
prog = re.compile(pattern)
result = prog.match(string)
# is equivalent to
result = re.match(pattern, string)
import re
# Splitting will occurs only once, at '05', returned list will have length 2
print(re.split('\d+', 'On 05th Jan 1999, at 11:02 AM', 1))
# 'Boy' and 'boy' will be treated same when flags = re.IGNORECASE
print(re.split('[a-f]+', 'Aey, Boy oh boy, come here', flags=re.IGNORECASE))
print(re.split('[a-f]+', 'Aey, Boy oh boy, come here'))
re.split(pattern, string, maxsplit=0, flags=0)