Bug 148989 - [65cat] Allow linebreaks, tabs for Find/Replace actions
[65cat] Allow linebreaks, tabs for Find/Replace actions
Status: NEW
Product: editor
Classification: Unclassified
Component: Search
6.x
PC Windows XP
: P3 with 12 votes (vote)
: 7.2
Assigned To: Milutin Kristofic
issues@editor
80patch-candidate
: PLAN
: 158046 184191 189029 194292 195575 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-02 16:46 UTC by ulfzibis
Modified: 2015-02-17 05:58 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2008-10-02 16:46:20 UTC
[ BUILD # : 200809220201 ]
[ JDK VERSION : 1.6.0_07 ]

Assume, you want find:
"+
    "
, and maybe replace it by nothing,
or find white-spaces or braces at line-end.

These simple actions IMHO should be possible, by marking the search
pattern by mouse, and search by Ctrl-F.

Also the replace string in Replace action should work, if mouse
selected pattern contains tabs or line-ends.

Most other editors have this, e.g. Notepad++.
Comment 1 Andrey Yamkovoy 2009-01-28 14:29:32 UTC
In description you are talking about editor search. So reassign to the editor for evaluation.
As for the "Find In Project" functionality you can find line breaks by using '\r' and '\n' in the regexp. The same for
the replace ...
Comment 2 ulfzibis 2009-01-28 17:49:07 UTC
Yes, the regex way is a kind of workaround here, but ...
1. it must be learned, nothing for beginners, of if you are in a hurry. wildcard's are much more complicated than just
using '*'.
2. I'm more thinking about a cut-'n-paste usage for find AND replace.

What about of transforming the cut string to a valid regex-string on pasting it into the Find/Replace dialogue?
Comment 3 ulfzibis 2010-09-23 11:15:54 UTC
(In reply to comment #2)
> What about of transforming the cut string to a valid regex-string on pasting it
> into the Find/Replace dialogue?

Another interesting idea.
This would slightly teach users in regex over the time, a little!

But please have a look on combined find/replace dialogue of NotePad++, and how they deal with \n \t etc..
This is my favourite from all editors.

I think, we don't need 2 separate dialogues and actions for find and replace, but better availability in any context e.g. bug 187174 148984 146810.
Comment 4 David Strupl 2011-01-13 10:04:55 UTC
*** Bug 194292 has been marked as a duplicate of this bug. ***
Comment 5 David Strupl 2011-01-13 10:05:28 UTC
*** Bug 189029 has been marked as a duplicate of this bug. ***
Comment 6 David Strupl 2011-01-13 10:06:07 UTC
*** Bug 184191 has been marked as a duplicate of this bug. ***
Comment 7 David Strupl 2011-01-13 10:06:51 UTC
*** Bug 158046 has been marked as a duplicate of this bug. ***
Comment 8 malfunction84 2011-02-17 16:10:00 UTC
*** Bug 195575 has been marked as a duplicate of this bug. ***
Comment 9 Milutin Kristofic 2012-01-25 12:34:14 UTC
I will change whole infrastructure for search, which will enable multiline search and regexps.

This is a big change and it doesn't have a high priority now. I hope it will be at least in 7.3.
Comment 10 swpalmer 2014-03-15 03:21:18 UTC
Regexp search/replace is working in NB 8.0 FCS build.  I just used it to match newline characters with \n.  I think this issue can be closed.
Comment 11 markiewb 2014-03-15 08:29:58 UTC
(In reply to swpalmer from comment #10)
> Regexp search/replace is working in NB 8.0 FCS build.  I just used it to
> match newline characters with \n.  I think this issue can be closed.

I do not think so. The request [1] was to paste in text which has linebreaks and which isn't formatted as regex.

[1] https://netbeans.org/bugzilla/show_bug.cgi?id=148989#c0
Comment 12 rhp195 2014-04-01 22:45:18 UTC
I also don't think this should be closed. The functionality needed is to allow the user to select text in the editor and find other occurrences of that selected text at least within the current document.

For me, I want to be able to find duplicate blocks of code in order to identify functionality that can be replaced with more maintainable functions.
Comment 13 lindberg123 2014-04-22 12:28:19 UTC
Bump. Really, without this in my workflow I consider stop using Netbeans. I started using it today. This is such a simple but useful thing to create. Have I missed anything? I dont want to convert things on the fly to regex. 

Sometimes I just want to do a fast search marking text .. 
- copy
- ctl+f
- paste
- enter
.. and editor jumps to line

Even Dreamweaver has this since 2005.
Comment 14 Miloslav Metelka 2014-05-14 14:40:41 UTC
(In reply to lindberg123 from comment #13)
> Sometimes I just want to do a fast search marking text .. 
> - copy
> - ctl+f
> - paste
> - enter
> .. and editor jumps to line

NetBeans has Ctrl+F3 to search either selected text or an identifier under cursor (if no selection is present).
Comment 15 ulfzibis 2014-08-02 15:53:15 UTC
I think, 10 votes can be considered as more than P4.
Comment 16 hans_adler 2014-10-12 08:40:05 UTC
Here is a concrete example of something that should work, but doesn't. Ages ago, in code that I am cleaning up, a tool created lots of named queries that were never used. They are still present in 75 files and look like this:

@NamedQueries({
  @NamedQuery(name = ..., query = ...),
  @NamedQuery(name = ..., query = ...),
  @NamedQuery(name = ..., query = ...),
  @NamedQuery(name = ..., query = ...),
  ...
})

I tested the following regular expression in a search:

@NamedQueries\(\{.*?\}\)

But the matching appears to be done line by line, so this doesn't work. If it did, I would be able to clean up all files in a single operation.

There should be an option for global matching rather than line-by-line matching. I think that would also take care of the original request. The default for this option should be single-line search except when multiline text is pasted into the search field. For multi-line search in Literal and Basic Wildcards mode, the "containing text" field should be a text area. In Basic Wildcards mode, * and ? should not match text containing line breaks, and any style of literal line break (\n, \r, \r\n) should match any style of line break in the files.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo