This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Pattern Syntax Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Pattern Syntax Exception" Watch "Pattern Syntax Exception" New topic

Pattern Syntax Exception

Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509

In this example when will a Pattern Syntax Exception thrown?
Ruben Soto
Ranch Hand

Joined: Dec 16, 2008
Posts: 1032
Hi Abhi,

Your example won't throw a PatternSyntaxException. That's thrown by compile, when you give bad syntax for the regex. For example, try deleting the period (.) and run your program again.

All code in my posts, unless a source is explicitly mentioned, is my own.
Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509
Thanks. Ruben.
Consider Paul's rocket mass heater.
subject: Pattern Syntax Exception