This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Unicode, escape seq Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Unicode, escape seq" Watch "Unicode, escape seq" New topic

Unicode, escape seq

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710

Why \\u "double escape character" invalid?
I miss this concern with regex where we require "\\d" instead of "\d", we need two "\\" before d.
Please guide me!

Thanks and Regards,

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
This is the grammar for a Unicode escape from the Java Language Specification.

\ UnicodeMarker HexDigit HexDigit HexDigit HexDigit

the letter you - this site won't let you put the letter by itself
UnicodeMarker u

So you don't want to start with two backslashes because that will mean the second backslash should be interpreted as just the backslash and not as part of the Unicode escape.

Also this grammar implies that you can repeated the Unicode marker.

That is, each of these seperately will compile.


and so on.
[ April 03, 2007: Message edited by: Keith Lynn ]
Antonio Trapero

Joined: Mar 24, 2007
Posts: 11
And boys, dont forget,
big farms need red tractors
\b \f \n \r \t
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710
Thanks Keith and Antonio!

Thanks and Regards,
I agree. Here's the link:
subject: Unicode, escape seq
It's not a secret anymore!