Bug 200603 - [Dialogs] String matching on "*" and "?" in SearchPattern is confusing
Summary: [Dialogs] String matching on "*" and "?" in SearchPattern is confusing
Status: RESOLVED DUPLICATE of bug 259741
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Susan McCourt CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 16:20 EDT by Xiaoyang Guan CLA
Modified: 2009-07-30 09:44 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiaoyang Guan CLA 2007-08-20 16:20:11 EDT
Build ID: I20070621-1340

Steps To Reproduce:
1. Open the Open Resource dialog (or the Open Type dialog, which both use the FilteredItemsSelectionDialog as the base).
2. Type "*" in the pattern input box. It matches nothing. 
3. Re-type a single "?" in the input box. It matches every resource items.
4. Type "**" in the input box will also match every items.

Since "?" means any single character and "*" means any string, this matching behavior is very confusing.


More information:
Comment 1 Paul Webster CLA 2007-08-21 10:21:26 EDT
(In reply to comment #0)
> Since "?" means any single character and "*" means any string, this matching
> behavior is very confusing.

I thought * means 0 or more of the preceding char ... what happens if you use ".*" (the regex for <any char><or or more times>

PW
Comment 2 Xiaoyang Guan CLA 2007-08-21 17:18:29 EDT
Yes, ".*" matches any string.  I've thought about this before, but then thought that it should apply to "?" as well, i.e., "?" matches 0 or 1 times of the preceding regular expression block in the extended regular expression.  It's not clear to me what level of the regular expression is interpreted by the SearchPattern.  I tried to compare with the behavior of UNIX grep and egrep.  grep matches nothing with "*" and matches "?" as a literal since "?" is not a metacharacter in the traditional regular expression; while egrep matches anystring with either "*" or "?".

In any case, the prompt message above the input box in the Open Resource dialog says "(? = any character, * = any string)", which seems to be confusing if "*" actually does not match any string.
Comment 3 Paul Webster CLA 2007-08-21 18:51:12 EDT
(In reply to comment #2)
> In any case, the prompt message above the input box in the Open Resource dialog
> says "(? = any character, * = any string)", which seems to be confusing if "*"
> actually does not match any string.

Ah, agreed.
PW
Comment 4 Krzysztof Michalski CLA 2007-08-28 12:14:27 EDT
Now it works in the old OpenType dialog manner. People very often use patterns with * at the beggining, so we decided to ignore a single * and it should be treated as a feature.
Comment 5 Szymon Brandys CLA 2008-05-30 11:28:30 EDT
Reassigning to Susan.
Comment 6 Susan McCourt CLA 2009-07-09 17:37:30 EDT
as per 2009 triage guidelines
Comment 7 Markus Keller CLA 2009-07-30 09:44:58 EDT

*** This bug has been marked as a duplicate of bug 259741 ***