Solved

java.util.regex.PatternSyntaxException: Illegal character range error

Posted on 2008-10-29
2
2,827 Views
Last Modified: 2008-10-29
while debugging some code, I ran across this error:

Caused by: java.util.regex.PatternSyntaxException: Illegal character range near index 14
\bFOR [A-Z][1-0] ADD\b
^

I've never worked with regular expressions much in java, but I have in perl.  that error seems to me like it is being caused by the [1-0] range.  shouldn't the correct way to specify that would be [0-1]?  just wanted to make sure I'm on the right track.  thanks!
0
Comment
Question by:texasreddog
  • 2
2 Comments
 
LVL 8

Expert Comment

by:MatthiasVance
Comment Utility
The correct way of specifying a character range is indeed [beginChar-endChar], as you stated.

Kind regards,

Matthias Vance
0
 
LVL 8

Accepted Solution

by:
MatthiasVance earned 500 total points
Comment Utility
But on the other hand, you can just do [01] if you want to catch both 0 and 1.
There's no need to specify a range for that.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now