Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368474

Summary: [implementation] Find / Replace; Escape Regular Expression routine leaves out leading zero
Product: [Eclipse Project] Platform Reporter: Jeremy Flicker <jflicke>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.6.2   
Target Milestone: 3.8 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Jeremy Flicker CLA 2012-01-12 12:45:44 EST
Build Identifier: Version: 3.6.2 Build id: M20110210-1200

The method FindReplaceDocumentAdapter.escapeForRegExPattern(String), when handed a character less that \x20, will often escape that character using the \xhh format.  However, if the leading digit is a 0, the 0 will not be included in the escaped string.

This leads to at least one defect in the base eclipse experience described below... plus my product is re-using this method so it would help my product to also fix this

Reproducible: Always

Steps to Reproduce:
1.Open a text editor
2. Engage find / replace
3. Enable regular expressions
4. Replace a character in your file with the escape sequence \x08
5. Now that character is in your text file
6. Close find \ replace
7. Select that character in the text editor
8. Re-engage find \ replace.
9. The Find dialog appears with the value \x8 in the Find text field.

\x8 is not a valid regular expression escape sequence, so pressing find will give the user an error message saying as much.
Comment 1 Dani Megert CLA 2012-01-13 06:01:56 EST
Bug in FindReplaceDocumentAdapter.escapeForRegExPattern(String).
Comment 2 Dani Megert CLA 2012-01-13 06:19:16 EST
Fixed in master: ff9f8f3686f510c0a4a153225ebe8a5d4f092f9f