문제 설명
쉼표로 문자열을 분할하지만 대괄호 또는 따옴표로 묶인 쉼표는 무시하십시오. (Split string by comma but ignore commas in brackets or in quotes)
hello, "darkness, my", (old, friend)
와 같은 문자열이 있고 다음과 같은 분할 결과를 원합니다. hello
"darkness, my"
(old, friend)
"‑marks(, ?=([^\"]*\"[^\"]*\")*[^\"]*$
) 및 대괄호(,(?= [^\\)]*(?:\\(|$))
). 처음 사용할 때 다음과 같이 표시됩니다. hello
"darkness, my"
(old
friend)
두 번째를 사용하면 다음을 얻습니다.
안녕하세요
"darkness
my"
(old, friend)
하지만 이 두 솔루션을 어떻게 결합합니까? ?
참조 솔루션
방법 1:
Probably easier to match the parts, rather than splitting them.
This will capture each piece of data as group 1.
(by Selphiron、Whothehellisthat)