title: Split a string using space when not surrounded by specific characters
body: <p>I need to split a string using space but keep together the words surrounded by a specific character.
  The specific characters can be <code>`</code>, <code>*</code> or  <code>**</code>.</p>
  
  <p>Let me give an example:</p>
  
  <pre><code>The `String class` represents character strings.
  All *string literals* in **Java programs**, such as **abc**
  </code></pre>
  
  <p>I want to have this result:</p>
  
  <pre><code>The
  `String class`
  represents
  character
  strings.
  All
  *string literals*
  in
  **Java programs**
  ,
  such
  as
  **abc**
  </code></pre>
  
  <p>I am able to write regexp which split my input string to parts if I have only one kind of marker character. But unfortunately, I have multiply markers.</p>
  
  <p>This is the regexp I use in my code: <code>[^\s"]+|"[^"]*("|$)</code>. This works fine only with one marker:</p>
  
  <pre><code>String marker = "`";
  String data = "The `String class` represents character strings. All *string literals* in **Java programs**, such as **abc**...";
  
  String regexp = "[^\\s" + marker + "]+|" + marker + "[^" + marker + "]*(" + marker +"|$)";
  Pattern pattern = Pattern.compile(regexp);
  Matcher regexMatcher = pattern.matcher(data);
  
  while (regexMatcher.find()) {
      System.out.println(regexMatcher.group());
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>The
  `String class`
  ...
  *string
  literals*
  in
  **Java
  programs**,
  such
  as
  **abc**...
  </code></pre>
  
  <p>I have tried to stick multiply markers, but the following solution does not work: </p>
  
  <pre><code>String marker = "`|\*"
  </code></pre>
  
  <p>I can write java code to do this job, but I thought that using regexp can be easier. But I am not sure about it now.</p>