QueryParser and Special Characters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

QueryParser and Special Characters

Peter.Kipping
The documentation tells us to escape special characters by using the \

Example:

\(1\+1\)

However if we put this in a string

String query = "\(1\+1\)";

Then the java compiler throws an Invalid Escape Sequence error.
QueryParser doesn't seem to recognize the double backslash.  Is there a
workaround for this?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: QueryParser and Special Characters

Chris Lamprecht
You might need a double backslash, since the string \(1\+1\)
represented in Java is "\\(1\\+1\\)" (see the javadocs for
java.util.regex.Pattern for a better explanation).


On 5/9/05, Kipping, Peter <[hidden email]> wrote:

> The documentation tells us to escape special characters by using the \
>
> Example:
>
> \(1\+1\)
>
> However if we put this in a string
>
> String query = "\(1\+1\)";
>
> Then the java compiler throws an Invalid Escape Sequence error.
> QueryParser doesn't seem to recognize the double backslash.  Is there a
> workaround for this?
>
> Thanks,
> Peter
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]