Solved

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

Posted on 2008-10-29
2
3,108 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I remove an object from a 3 53
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO) 1 60
junit example issue 2 27
Java array 21 86
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

733 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