This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Building this regular expression with replaceAll Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Building this regular expression with replaceAll" Watch "Building this regular expression with replaceAll" New topic
Author

Building this regular expression with replaceAll

Francesco Marchioni
author
Ranch Hand

Joined: Sep 22, 2003
Posts: 175
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


JBoss AS 5 Development
JBoss Tutorials
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
I already answered this question over at the Java Forums.

Tsk, tsk!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Building this regular expression with replaceAll
 
Similar Threads
Counting words in a String
Capturing "Enter Key" Value in Javascript
remove "." from string
replaceall() doubt
how to check whether BigDecimal or String is whole number or not ?