Bug 69027 - Cannot escape characters in Regular Expressions
Summary: Cannot escape characters in Regular Expressions
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 minor (vote)
Target Milestone: 3.0   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-30 11:35 EDT by Chris Rosenbury CLA
Modified: 2004-10-27 06:52 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rosenbury CLA 2004-06-30 11:35:58 EDT
The JDK 1.4 supplies a new method for the String class called split().  The 
split method takes a String parameter that represents a regular expression.

The java editor reports an error when the character in the string is escaped 
unless the character being escaped is one of a very few characters.

For example
  String[] myStringArray = originalString.split("\)");
causes an error claiming that ')' is not a valid escaped character.

If I do not escape it, the regular expression parser throws an exception 
claiming a parenthesis is missing.
Comment 1 Olivier Thomann CLA 2004-06-30 13:57:28 EDT
Try to write this:
String[] myStringArray = originalString.split("\\)");

If you want the character \, you need to put \\ in a java string.

Let me know if this is ok to close.
Comment 2 Olivier Thomann CLA 2004-07-04 10:04:34 EDT
Close as INVALID.