• Post Reply Bookmark Topic Watch Topic
  • New Topic

Building this regular expression with replaceAll  RSS feed

 
Francesco Marchioni
author
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm having problems in building a regular expression
that transforms negative numbers.

I need to put a single quote around negative numbers.
That is:

String formula = "SWITCH: case 1: method1() case -1: exit()";

should become:

"SWITCH: case 1: method1() case '-1': exit()";

Does anybody know how to obtain it with replaceAll() ?
Thanks a lot
Francesco
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I already answered this question over at the Java Forums.

Tsk, tsk!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!