title: Why does String.split need pipe delimiter to be escaped?
body: <p>I am trying to parse a file that has each line with pipe delimited values.
  It did not work correctly when I did not escape the pipe delimiter in split method, but it worked correctly after I escaped the pipe as below.</p>
  
  <pre><code>private ArrayList&lt;String&gt; parseLine(String line) {
      ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
      String[] list_str = line.split("\\|"); // note the escape "\\" here
      System.out.println(list_str.length);
      System.out.println(line);
      for(String s:list_str) {
          list.add(s);
          System.out.print(s+ "|");
      }
      return list;
  }
  </code></pre>
  
  <p>Can someone please explain why the pipe character needs to be escaped for the <code>split()</code> method?</p>