-
Enhancement
-
Resolution: Other
-
P4
-
None
-
None
Name: rmT116609 Date: 08/26/2004
A DESCRIPTION OF THE REQUEST :
The intention of this proposed change is to make writing regular expressions more straightforward and more Perl-like. Writing a regular expression in Java is, besides thinking about logic, also about adding a lot of backslashes.
Instead of the double quote I suggest to use the back quote (what's in a name), and also a RegexString object that extends the String object.
Examples:
"\\(.*?\\)" .equals(`\(.*?\)`);
`\(hello\)`.equals("\\(hello\\)");
Pattern p = Pattern.compile(`\s+\d+`);
JUSTIFICATION :
Although escaping special characters with a backslash is in the Java Language Specification, the result is that regular expressions become less readable and maintainable. To get rid of the extra backslashes I suggest to create this new String-like object that handles backslashes more gracefully.
(Incident Review ID: 237231)
======================================================================
A DESCRIPTION OF THE REQUEST :
The intention of this proposed change is to make writing regular expressions more straightforward and more Perl-like. Writing a regular expression in Java is, besides thinking about logic, also about adding a lot of backslashes.
Instead of the double quote I suggest to use the back quote (what's in a name), and also a RegexString object that extends the String object.
Examples:
"\\(.*?\\)" .equals(`\(.*?\)`);
`\(hello\)`.equals("\\(hello\\)");
Pattern p = Pattern.compile(`\s+\d+`);
JUSTIFICATION :
Although escaping special characters with a backslash is in the Java Language Specification, the result is that regular expressions become less readable and maintainable. To get rid of the extra backslashes I suggest to create this new String-like object that handles backslashes more gracefully.
(Incident Review ID: 237231)
======================================================================
- relates to
-
JDK-8061408 Add support for verbatim string literals
- Closed
-
JDK-6237556 Addition of Map initialising syntax
- Closed
-
JDK-8061413 Add extensible arrays and dictionaries to the syntax
- Closed