Skip to main content



      Home
Home » Newcomers » Newcomers » File Search: Exact string
File Search: Exact string [message #271248] Thu, 28 May 2009 19:56 Go to next message
Eclipse UserFriend
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 #271254 is a reply to message #271248] Thu, 28 May 2009 23:29 Go to previous messageGo to next message
Eclipse UserFriend
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.
>


--
R. Ian Bull | EclipseSource Victoria | +1-888-679-8753
http://eclipsesource.com | http://twitter.com/eclipsesource
Re: File Search: Exact string [message #271263 is a reply to message #271254] Fri, 29 May 2009 07:51 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #271293 is a reply to message #271279] Fri, 29 May 2009 18:47 Go to previous messageGo to next message
Eclipse UserFriend
Eric Rizzo wrote:

> 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

Thanks for the reply. I just wanted to make sure that I wasn't missing a
feature that already existed, but it sounds like I'm not. I'll just use
the regex option since it works.
Re: File Search: Exact string [message #271351 is a reply to message #271293] Wed, 03 June 2009 03:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mnm.criion.net

Regex's are also easy to use once you get the hang of them, plus you get
*free* regex training :)

If you wanted a "Complete words only" search, you could just have added
a white space around it as Ian suggested
--
-michael
Re: File Search: Exact string [message #271409 is a reply to message #271351] Sat, 06 June 2009 04:02 Go to previous message
Eclipse UserFriend
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
Previous Topic:Tutorial or info on simple user runtime library
Next Topic:Unable to import project to eclipse
Goto Forum:
  


Current Time: Sun Jul 20 05:36:27 EDT 2025

Powered by FUDForum. Page generated in 0.49768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top