Solved

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

Posted on 2008-10-29
2
3,180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 8

Expert Comment

by:MatthiasVance
ID: 22834103
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
ID: 22834111
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

688 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