search exact word
Asked by Ewa ?liwi?ska:

**I would like to search simply for word "*logs*"** . Unfortunately, that gives me a hundred of results, from which most are "*logging* ", "*logged* ", "*log* ", which are very similar, but it's hard to shell from them.  

I tried with single/double quotes and without them.  

I seem like a duplicate of [this](https://community.atlassian.com/t5/Confluence-questions/Confluence-Search-How-to-force-a-real-exact-match/qaq-p/137805) topic, but answers from there haven't helped me. I'm using Confluence 6.4.1.  

[This](https://community.atlassian.com/t5/Questions/Exact-search-in-text-field/qaq-p/168124) and [this](https://community.atlassian.com/t5/Jira-questions/How-do-I-do-a-text-search-for-exact-words/qaq-p/418336) topic also haven't helped me - I'm not using any special chars/regular expressions.  
Besides, they are quite old.   
I also checked an [error](https://jira.atlassian.com/browse/JRASERVER-25092) which is connected with search, but it is resolved.  

I feel like I'm missing something because it seems that I can't use a very basic functionality (and quite important ;)).  

Thanks in advance.


Answers:
author: Davin Studer
body: Try this in your search. A little know feature is that Confluence can also do regular expression searches. Put it in the search box exactly as is below.

```
/.*logs.*/
```

comments: author: Ewa ?liwi?ska
body: Great, this works like a charm. Thanks a lot!  
You're right, I didn't know that, even during searching (in [this](https://community.atlassian.com/t5/Jira-questions/How-do-I-do-a-text-search-for-exact-words/qaq-p/418336) topic) I found excactly opposite information (I know that this is all topic) ;)  
It's a shame that Attlasian team wasn't the one who respond with this solution.


author: Shannon S
body: Hi Ewa,

This expression that Davin has sent you is a wildcard search, as documented here:

* [Confluence Search Syntax](https://confluence.atlassian.com/doc/confluence-search-syntax-158720.html)

> Leading wildcards
>
> Lucene doesn't allow wildcards at the beginning of your search, but you can format your search as a regular expression as a workaround. For example, you can't search for `*hum*` or `?hum*`, as they begin with a wildcard, but you can search for /.\*hum.\*/ and find things like hum, human, and inhumane.

Please be aware that it will return all results that include "logs" and not restrict to only "logs". Therefore it could potentially find things like analogs, epilogs, etc. and return more search results than intended.

If you do not like this behavior, then you can still vote on the feature request I sent you for exact text search.

I hope that clarifies things!

Regards,  
Shannon


author: Ewa ?liwi?ska
body: Dear Shannon,  

thank you for this note.  
However, this is you who could tell me what Davin told - cause in my case this is much better than just waiting for exact search to be exact search.  
This is another thing - I already voted on this bug and filled the survey. That doesn't change the fact that this workaround is this particular case works like a charm for me. Actually, I didn't even notice any wider results.  
So in both cases we have more results than we expect, we just need to pick which evil is less :)  
Probably there is a way to write regular expression to exact word, I don't know that, but I also don't need it at the moment.


author: Davin Studer
body: That is true that the above search could be a bit greedy and get more than just logs. It could be edited if you know more about your data. For instance if you know that the word logs will always have a space before and after you could change the search to this ...

```
/.* logs .*/
```

Or if sometimes logs ends a sentence and sometimes it is inside a sentence you could do ...

```
/(.* logs .*)|(.* logs\..*)/
```

One things to keep in mind is that if you have a problem and you are trying to solve it with regular expressions ... now you have two problems. Sorry ... just a little programming humor there. Certainly regular expression searches are typically for more advanced programmer type users ... but it is there and if you know your data well you can get around some Confluences search limitations this way.


author: Ewa ?liwi?ska
body: OK, thank you too :)  
Funny ;\>  
I don't know that data at all, it's not my data, I'm just looking for a needle in a haystack ;)  
But you're right, in most cases it will probably be like you wrote + maybe some bracet for "Logs" on the beginning of a sentence.


author: Shannon S
body: Ewa,

This is something we're indeed working on and you can track below:

* [CONFSERVER-14910](https://jira.atlassian.com/browse/CONFSERVER-14910)

It will help us if you can provide your feedback on the following survey:

* [Confluence server - search](https://sshaheed.typeform.com/to/D2kTH2)

In the meantime, I would recommend using a more specific search term to get exactly the result you need.

Thank you for your understanding.

Regards,

Shannon

comments: author: Ewa ?liwi?ska
body: Thank you. Can't use more specific search term because then I find nothing :) This was my last resort. But it's good to know that you are working on it, good luck and have a good day :)