You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Erik Hollensbe <be...@isle.yi.org> on 2001/10/04 02:50:37 UTC

escaping questions

I know this has probably been asked before, so I'll try to be brief.

I'm having trouble getting java's string interpolation to work with the RE constructor... It tells me that the pre-defined character classes are illegal escapes.

I can't find anything about this in the java.lang.String documentation or the RE documentation. I can't find anything in the FAQ.

Below is an example of the error message that I get. Here is an example of what I'm trying to achieve:

RE reMailHead  = new RE("(\w+):\s+(.+)\r\n");


MailRead.java:12: illegal escape character
    RE reMailHead  = new RE("(\w+):\s+(.+)\r\n");
                                           ^                  

Thanks for your time.

-- 
Erik Hollensbe
belman@isle.yi.org


Re: escaping questions

Posted by "Timothy E. Cronin" <tc...@austin.rr.com>.
shouldn't be:
RE reMailHead  = new RE("(\\w+):\\s+(.+)\\r\\n")



At 05:50 PM 10/3/2001 -0700, Erik Hollensbe wrote:
>I know this has probably been asked before, so I'll try to be brief.
>
>I'm having trouble getting java's string interpolation to work with the RE 
>constructor... It tells me that the pre-defined character classes are 
>illegal escapes.
>
>I can't find anything about this in the java.lang.String documentation or 
>the RE documentation. I can't find anything in the FAQ.
>
>Below is an example of the error message that I get. Here is an example of 
>what I'm trying to achieve:
>
>RE reMailHead  = new RE("(\w+):\s+(.+)\r\n");
>
>
>MailRead.java:12: illegal escape character
>     RE reMailHead  = new RE("(\w+):\s+(.+)\r\n");
>                                            ^
>
>Thanks for your time.
>
>--
>Erik Hollensbe
>belman@isle.yi.org