File Search: Exact string [message #271248] |
Thu, 28 May 2009 19:56  |
Eclipse User |
|
|
|
So I've tried searching for an answer to this and surprisingly I haven't
found this asked before. In file search, how do I search for an exact
string? If I search for "foo" (without the quotes), I get "foobar",
"food", etc. Do I have to use regular expressions to do match strings
exactly?
Thanks.
|
|
|
|
Re: File Search: Exact string [message #271263 is a reply to message #271254] |
Fri, 29 May 2009 07:51   |
Eclipse User |
|
|
|
Ian Bull wrote:
> What do you mean by exact string? If you searched for foo, would you
> want it to return "foo" (foo) or 'foo'. Or do you mean foo on a line by
> itself? If you want foo surrounded by white space you could try and
> search for " foo " without the quotes, or else I would use regex. I
> think ^foo$ will give you lines that start and end with exactly foo.
> cheers,
> ian
> Peter Samson wrote:
>> So I've tried searching for an answer to this and surprisingly I haven't
>> found this asked before. In file search, how do I search for an exact
>> string? If I search for "foo" (without the quotes), I get "foobar",
>> "food", etc. Do I have to use regular expressions to do match strings
>> exactly?
>>
>> Thanks.
>>
I am referring to finding an exact match for a search query. So in my
example, as you said I want foo surrounded by white space-not "food" or
"foobar", etc. IDEs like VisualStudio have this option without having to
use regular expressions so I find it odd that such a basic feature doesn't
exist in Eclipse.
|
|
|
Re: File Search: Exact string [message #271279 is a reply to message #271263] |
Fri, 29 May 2009 16:05   |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Peter Samson wrote:
> Ian Bull wrote:
>
>> What do you mean by exact string? If you searched for foo, would you
>> want it to return "foo" (foo) or 'foo'. Or do you mean foo on a line
>> by itself? If you want foo surrounded by white space you could try
>> and search for " foo " without the quotes, or else I would use regex.
>> I think ^foo$ will give you lines that start and end with exactly foo.
>
>> cheers,
>> ian
>
>
>> Peter Samson wrote:
>>> So I've tried searching for an answer to this and surprisingly I
>>> haven't found this asked before. In file search, how do I search for
>>> an exact string? If I search for "foo" (without the quotes), I get
>>> "foobar", "food", etc. Do I have to use regular expressions to do
>>> match strings exactly?
>>>
>>> Thanks.
>>>
>
>
> I am referring to finding an exact match for a search query. So in my
> example, as you said I want foo surrounded by white space-not "food" or
> "foobar", etc. IDEs like VisualStudio have this option without having to
> use regular expressions so I find it odd that such a basic feature
> doesn't exist in Eclipse.
>
Sounds like you're looking for a "complete words only" option. You are
welcome to enter a feature request for that into Bugzilla
(https://bugs.eclipse.org/bugs) but I think they've taken the approach
that anything more complex like that will just use regex. The potential
options for text search are almost endless and the UI could quickly
become cluttered and unusable if everyone's favorite option was included.
Of course I could be totally wrong in my assumptions about the reasons
for the current UI... best to enter a feature request (actually, search
for an existing one first, as you may not be the first person to want
such a thing).
Hope this helps,
Eric
|
|
|
|
|
Re: File Search: Exact string [message #271409 is a reply to message #271351] |
Sat, 06 June 2009 04:02  |
Eclipse User |
|
|
|
Michael Madsen wrote:
> If you wanted a "Complete words only" search, you could just have added
> a white space around it as Ian suggested
That won't find words that start or end on a line. I would use the regex
\bfoo\b
|
|
|
Powered by
FUDForum. Page generated in 0.49768 seconds