1
長い文字列があり、大括弧またはかっこで囲まれていない限り、コンマで区切って配列に設定します。大括弧またはかっこで囲まれていない場合はカンマで区切ります
Harry Potter, Hermione, (Severus, Snape)
Returns:
Harry Potter
Hermione
Severus, Snape
例2:
あなたが使用することができますHarry Potter, [and, the chamber, of secrets], Hermione, (Olivanders, Wands)
Returns:
Harry Potter
and, the chamber, of secrets
Hermione
Olivanders, Wands
@Marc - 私はその質問を見ましたが、私が探している条件の両方を説明する方法はまだ分かりませんでした。 – Keren
この質問は角かっこ**と**かっこについてです。完全な答えは難しいです。 – Bathsheba
@Bathsheba http://stackoverflow.com/questions/28587081/regex-split-on-comma-but-exclude-commas-within-parentheses-and-quotesboth-s –