Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Pattern is not working for spl cha..?

 
Naveen Raja
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Could someone tell me why the following code is not working..?





Thanks a lot in Advance....

[ Edited to use code tags - Paul Sturrock ]
[ November 09, 2006: Message edited by: Paul Sturrock ]
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Square brackets are special characters in regular expressions so they have to be escaped.

Alternatively you could use the Pattern.LITERAL flag


Or you could do this
All three forms produce the same result.
 
Naveen Raja
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Garrett Rowe....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic