Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>line 23:26: unexpected char: 0x0 </code></pre> <p>This error message points to this part of the code:</p> <pre><code>def illegalChars = ~/[\u0000-... 12345678901234567890123 </code></pre> <p>It looks like for some reason the compiler doesn't like having Unicode 0 character in the source code. That said, you should be able to fix this by doubling the slash. This prevents Unicode escapes at the source code level, and let the regex engine handle the unicode instead:</p> <pre><code>def illegals = ~/[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\u007F-\\u009F]/ </code></pre> <p>Note that I've also combined the character classes into one instead of as alternates. I've also removed the range definition when they're not necessary.</p> <h3>References</h3> <ul> <li><a href="http://www.regular-expressions.info/charclass.html" rel="nofollow noreferrer">regular-expressions.info/Character Classes</a></li> </ul> <hr> <h3>On doubling the slash</h3> <p>Here's the relevant quote from <a href="http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/api/java/util/regex/Pattern.html" rel="nofollow noreferrer"><code>java.util.regex.Pattern</code></a></p> <blockquote> <p>Unicode escape sequences such as <code>\u2014</code> in Java source code are processed as described in <a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100850" rel="nofollow noreferrer">JLS 3.3</a>. Such escape sequences are also implemented directly by the regular-expression parser so that Unicode escapes can be used in expressions that are read from files or from the keyboard. Thus the strings <code>"\u2014"</code> and <code>"\\u2014"</code>, while not equal, compile into the same pattern, which matches the character with hexadecimal value <code>0x2014</code>.</p> </blockquote> <p>To illustrate, in Java:</p> <pre><code>System.out.println("\n".matches("\\u000A")); // prints "true" </code></pre> <p>However:</p> <pre><code>System.out.println("\n".matches("\u000A")); // DOES NOT COMPILE! // "String literal is not properly closed by a double-quote" </code></pre> <p>This is because <code>\u000A</code>, which is the newline character, is escaped in the second snippet at the source code level. The source code essentially becomes:</p> <pre><code>System.out.println("\n".matches(" ")); // DOES NOT COMPILE! // "String literal is not properly closed by a double-quote" </code></pre> <p>This is not a legal Java source code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload