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 127343 - Support Ant-like syntax in file name patterns
Summary: Support Ant-like syntax in file name patterns
Status: RESOLVED WORKSFORME
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2008-02-13 21:09 UTC by _ hair
Modified: 2013-10-15 07:16 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ hair 2008-02-13 21:09:15 UTC
The 'File name patterns' seems only to accept regular expressions against a file name.
Sometimes it is a particular path that i would like to restrict the search to.
For example i would like to able to enter into this field something like:

genericsitesearch.sesam.no/**/views.xml

so that only hits in files named views.xml somewhere underneath a directory genericsitesearch.sesam.no were to be returned.
Comment 1 Marian Petras 2008-07-10 11:06:00 UTC
This should not be a big technical problem but I am not sure it is needed that much. You can achieve the same if you
select directory "genericsitesearch.sesam.no" and enter pattern "views.xml". It should be a working and quite easy
solution for occasional need. What do you think?
Comment 2 _ hair 2008-07-10 11:22:58 UTC
> You can achieve the same if you select directory "genericsitesearch.sesam.no" and enter pattern "views.xml".

Neither are a regular expression pattern.
genericsitesearch.sesam.no, for example, contains a number of child projects.

Say for example i wanted to search
genericsitesearch.sesam.no/*.no/**/main/**/views.xml
Comment 3 Marian Petras 2008-07-10 11:29:13 UTC
> Say for example i wanted to search genericsitesearch.sesam.no/*.no/**/main/**/views.xml

Have you ever really needed to search using such complex pattern?
Comment 4 _ hair 2008-07-10 11:42:29 UTC
:-) 
well of course when i filed the issue.
sure it's an advanced usage, but it does not provide any extra UI in any way, just a more solid result from regular
expression searching.
Comment 5 Marian Petras 2008-07-10 13:59:40 UTC
It is doable and - surprisingly - parsing the pattern and scanning for the files should be the easiest part. The reason
is that the parser and scanner already exist in the JUnit module (package org.netbeans.modules.junit.output.antutils).

What is worse is that the Find... action currently does not necessarily search the directory structure. It accepts an
enumeration of DataObjects provided by the nodes.
Comment 6 Jesse Glick 2008-10-28 16:49:10 UTC
A well-tested variant of the matching logic can also be found in org.netbeans.spi.project.support.ant.PathMatcher,
though you would not want to depend on this module from search.
Comment 7 Jaroslav Havlin 2013-10-15 07:16:22 UTC
Find in Projects now supports "File Path Regular Expression" option, which should
be sufficient, hopefully.
Thank you for reporting.