I have a string like this
\"yJdz:jkj8h:jkhd::hjkjh\"
I want to split it using colon as a separator, but not a double colon. Desired result:
You can do this with lookahead and lookbehind, if you want:
>>> s = "yJdz:jkj8h:jkhd::hjkjh" >>> l = re.split("(?>> print l ['yJdz', 'jkj8h', 'jkhd::hjkjh']
This regex essentially says "match a : that is not followed by a : or preceded by a :"
: