How to split a string by commas positioned outside of parenthesis?

前端 未结 10 2101
南方客
南方客 2020-11-27 19:36

I got a string of such format:

\"Wilbur Smith (Billy, son of John), Eddie Murphy (John), Elvis Presley, Jane Doe (Jane Doe)\"

so basicly i

10条回答
  •  我在风中等你
    2020-11-27 20:17

    This post helped me a lot. I was looking to split a string by commas positioned outside quotes. I used this as a starter. My final line of code was regEx = re.compile(r'(?:[^,"]|"[^"]*")+') This did the trick. Thanks a ton.

提交回复
热议问题