How do you incorporate a regular expression into the Python string.split
method? Here is some sample code:
ip = '192.168.0.1:8080'
tokens = ip.split('[.|:]')
print tokens
This for some reason generates ['192.168.0.1:8080']
. Can someone point out what I'm missing? I've tried escaping characters and using double quotes, but nothing seems to change anything.