Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dangling Meta Character*

807591Nov 16 2005 — edited Apr 14 2008
Hi

I am getting following exception while executing this statement.can any body give anyt idea and how to fix this problem?


String sbr="this is kdfdanth redd*t from fdgkanth";
String bol=sbr.replaceAll("*"," ");
System.out.println("********* " + bol);

Exception in thread "main" java.util.regex.PatternSyntaxException: Dangling meta
character '*' near index 0
*
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at Max.main(Max.java:23)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2008
Added on Nov 16 2005
10 comments
13,206 views