Skip to Main Content

New to Java

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!

java.util.regex.PatternSyntaxException: Dangling meta character '?'

843785Oct 13 2008 — edited Oct 13 2008
I get error: java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0

in my code when I try to do this: String[] urlSplit = url.split("?");

The value of url = http://www.google.com/search?q=document.referrer

I'm pretty certain that '?' is an illegal character in regex and thats what is causing this, but I'm not sure how to fix this problem. I want to be able to split my string at the '?' as well.

Thanks.
Brian
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 10 2008
Added on Oct 13 2008
1 comment
1,049 views