| Summary: | [find/replace] pattern ^$ does not match empty line. | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Piotr Zielniok <griff> |
| Component: | Text | Assignee: | Platform-Text-Inbox <platform-text-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | daniel_megert, gillis+eclipse, mcfeber |
| Version: | 3.3 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
|
Description
Piotr Zielniok
Can reproduce with 3.4 M1. Java regex supports this. The code appears to be returning an improper response at line 233 in org.eclipse.jface.text.FindReplaceDocumentAdapter findReplace(....)
if (found && fFindReplaceMatcher.group().length() > 0)
return new Region(fFindReplaceMatcher.start(),
FindReplaceMatcher.group().length());
return null;
When ^ or $ is found by the java Matcher on regex search, the length of the group will be 0 as the offset in the Matcher's group[0] and group[1] will be the same location - but not -1.
Unless there is some other downstream (or upstream) reason for the null return on ^ or $, this code should be changed
The problem when fixing it there is - we cannot select invisible characters ==> the caret will disappear - Find Next will not work Something similar happens when you replace. ^(.*)$ => PRE\1POST doesn't work. It never matches. The expected result would be PREPOST for empty lines. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant please remove the stalebug whiteboard tag. |