This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 73615

Summary: Regex Boundary matchers
Product: editor Reporter: Martin Schovanek <mschovanek>
Component: SearchAssignee: Milutin Kristofic <mkristofic>
Status: RESOLVED WONTFIX    
Severity: blocker CC: jsprenkle
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description Martin Schovanek 2006-03-15 17:59:55 UTC
[#200603140300, jdk1.5.0]

I was trying comment out java code in .jsp so tried replace '^' regex with //,
but it is impossible in the Nb Editor.

to reproduce:
-------------
1) open a .java
2) invoke Edit > Replace
3) find: ^
4) replace with: //
5) check 'Regular Expression' check box
5) chose Replace
ERROR: "'^' not found" message appears at status line

ERROR2: Attempt to replace '^(.)' with '//\1' doesn't work too.
Comment 1 Daniel Prusa 2006-03-16 14:30:08 UTC
Searching works if you use regular expression of the form: ^.
We should investigate why there is no match found for the other variants.
Comment 2 Jiri Prox 2008-04-11 00:43:36 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 3 Sergey Petrov 2009-04-10 09:40:10 UTC
I tried to replace '^(.)' with '//\1' and all was replaces, what exactly do not work?
Can't reproduce with 090409, feel free to reopen if it still do not work as expected.
Comment 4 Martin Schovanek 2009-04-10 12:17:31 UTC
Still reproducible in 200904100201

I was trying to comment out all lines (put: '//' at the beginning of each line).  In VIM editor I can do it by:
:%s/^/\/\//
or
:%s/^\(.\)/\/\/\1/

After the first attempt i understood that Nb have problem with 'Boundary Matchers' (beginning / end of a line, ...) they
does not match any real chars so I was trying to pass by the second RE with 'Back Reference' but it does not work as well.

see:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
 
Comment 5 Sergey Petrov 2009-04-10 12:56:33 UTC
Thanks,
It seems editor can't find just start of line, end of line etc, it works like it need smth to be selected after search
or smth real can be replaced. Also nb do not combine info from find and replce fields as I understand.
So the issue is real, but it may be not an issue but some limitation in design on find-replace functionality. For
example openoffice replace dialog works the same way and can't find just "^".
Comment 6 Sergey Petrov 2009-04-22 12:40:32 UTC
For this issue there is alternative values(workaround) for search and replace fields: "(.+)" in search and "//$1" in
replace, this way all not empty lines will be commented.
Comment 7 Max Sauer 2009-09-29 15:10:13 UTC
Not so serious, lowering priority.
Comment 8 Martin Schovanek 2009-09-29 15:41:10 UTC
Can you please explain a little bit more? AFAIK the majority of coder's editors have proper RegExp support. Why it is
not serious for the Nb Editors?
Comment 9 David Strupl 2010-09-26 20:59:17 UTC
It is not so serious because
  1. we have it like this for the last 5 or so years
  2. workaround exists
  3. this issue has gathered exactly zero votes
Am I missing something? Of course I will be more than happy to apply any submitted patches (that would make sense).
Comment 10 Milutin Kristofic 2011-07-08 14:31:27 UTC
*** Bug 181168 has been marked as a duplicate of this bug. ***
Comment 11 Martin Balin 2016-07-07 07:29:40 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss