May 3, 2007 #1 royboy75 Programmer Joined Feb 13, 2007 Messages 114 Location 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?
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?
May 3, 2007 1 #2 Diancecht Programmer Joined Jan 8, 2004 Messages 4,042 Location ES You have to scape the asterisk, with \* I guess. Cheers, Dian Upvote 0 Downvote
May 3, 2007 Thread starter #3 royboy75 Programmer Joined Feb 13, 2007 Messages 114 Location GB 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(\\*)", "\\*"); Upvote 0 Downvote
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(\\*)", "\\*");
May 3, 2007 1 #4 Bong Programmer Joined Dec 22, 1999 Messages 2,063 Location US I think you might have to escape the partheses, too. _________________ Bob Rashkin Upvote 0 Downvote
May 3, 2007 Thread starter #5 royboy75 Programmer Joined Feb 13, 2007 Messages 114 Location GB Yep! working. Thanx Guys. Upvote 0 Downvote