title: Java Regex : Regex with "|" (Vertical bar or pipe) not working properly. Need a help to split a string by comma
body: <pre><code>Example 1:
  Input String : String1, {String2,String3},String4,[String5,String6]
  Regex to Split : &quot;,(?!([^{[]*[\]}]))&quot;
  Output : 
  [0] String1
  [1] {String2,String3}
  [2] String4
  [3] [String5,String6]
  </code></pre>
  <p>Demo : <a href="https://regex101.com/r/MUIA2J/1" rel="nofollow noreferrer">https://regex101.com/r/MUIA2J/1</a></p>
  <p>But instead of square brackets if we have double quotes characters or vertical bar/pipe chars, then it doesn't work.
  Like explained below</p>
  <pre><code>Example 2:
  Input String : String1, {String2,String3},String4,|String5,String6|
  Regex to Split : &quot;,(?!([^{|]*[\|}]))&quot;
  Output : 
  [0] String1
  [1] {String2,String3},String4,|String5,String6|
  </code></pre>
  <p>Why is that? How to achieve modify the regex in example-2 to get similar output as example-1?</p>