title: Java - String Parsing or split() bug in using multiple delimiters
body: <p>Ok, you might say that this is a duplicate post but it is different.</p>
  
  <p>I am working on a program that is working on some kind of deleting delimiters specified by the user. My program is working if the delimiter is only a single character (special or not). However, if the user input is a string, it removes the all characters of the delimiter from the message string.</p>
  
  <p>ex. String message = "ab\nc[d]e{fMardk1g(h)i}j";
  output will be : bcefghij
  but the expected output is abcdefghij</p>
  
  <p>I'm new in using the Pattern class, so I don't know where the problem lies.</p>
  
  <p>Here's the code in question (I put it in a testing class so I can isolate the problem):</p>
  
  <p>import java.util.regex.Pattern;</p>
  
  <pre><code>public class ParsingTest {
      public static void main(String[] args) {
          String[] delimiters = { "Mardk1", "\n", "[", "]", "{", "}", "(", ")" };  
          StringBuilder regexp = new StringBuilder("");  
          regexp.append("[");  
          for(String s : delimiters) {  
              regexp.append("[");  
              regexp.append(Pattern.quote(s));  
              regexp.append("]");  
          }  
          regexp.append("]");  
  
          String message = "ab\nc[d]e{fMardk1g(h)i}j";  
          StringBuilder result = new StringBuilder("");  
          String[] a = message.split(regexp.toString());  
          for(String string : a) {  
              result.append(string);
          }
          System.out.println(result);
          for(String str: a) System.out.print(str);
          System.out.println();
      }
  }
  </code></pre>