Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in regexp 2

Status
Not open for further replies.

royboy75

Programmer
Feb 13, 2007
114
GB
Hello,

I am trying to replace something in a string using:
query.replaceAll("COUNT(*)", "*");

But I get:
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 6 COUNT(*) ^

Can someone please help me with this?



 
You have to scape the asterisk, with \* I guess.

Cheers,
Dian
 
I tried it, not getting any error but it doesn't do the replacement either.
Here is what I've tried:
query = query.replaceAll("COUNT(\\*)", "\\*");
 
I think you might have to escape the partheses, too.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top