A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Joined: Dec 30, 2009
Mar 07, 2010 12:01:29
Why wouldn't this compile?
Pattern p = Pattern.compile("\\");
Is it not equivalent to creating a
Thanks for help in advance.
EDIT: I am very sorry for a misleading post. The above line of code compiles. But, throws an exception -
: Unexpected internal error near index 1.
Thanks Bear Bibeault.
Author and ninkuma
Joined: Jan 10, 2002
Mar 07, 2010 12:09:37
When reporting a compiler error, do you not think it'd be a good idea to include the error message?
Asking smart questions
Books by Bear
Joined: Sep 29, 2008
Mar 07, 2010 12:37:22
Check out any regular expression tutorial regarding the backslash, then consider how Java treats backslashes in strings.
Joined: May 26, 2003
Mar 07, 2010 19:11:14
Anoo Kota wrote:
Is it not equivalent to creating a pattern '\' ?
Yes, but that Pattern isn't valid. It says the next character as special meaning and there is no next character.
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
Don't get me started about those stupid
PGJC Exam - clarification?
While Loop Problem
Problem with parallel arrays when sorting in decending order
How To Write Some Text in a Horizontal Rule?
How do I start a web application on an xhtml page?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014