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