Split with single colon but not double colon using regex

Viewed 8636

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:

("yJdz", "jkj8h", "jkhd::hjkjh")

I'm trying with:

re.split(":{1}", "yJdz:jkj8h:jkhd::hjkjh")

but I got a wrong result.

In the meanwhile I'm escaping "::", with string.replace("::", "$$")

2 Answers
Related