title: Why \z for regular expression doesn't work for me?
body: <p>I read in the Oracle documentary that <code>\z</code> means end of the input. But the compilator throws errors. 
  I need to find a word "java" in text when java is the last word. Any sugestion how to deal with it?</p>
  
  <pre><code>import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  public class Why {
  
      public static void main(String[] args) {
          String language = "java";
          String text = "I'm fan of java";
          Pattern p = Pattern.compile("\\s" + language + "[\\W|\\z]");
          Matcher m = p.matcher(text);
          System.out.println(m.find());  // &lt;-------------- Exception 
  
      }
  
  }
  
  // Exception in thread "main" java.util.regex.PatternSyntaxException:
  //                Illegal/unsupported escape sequence near index 11 \sjava[\W|\z]
  </code></pre>