# Regexp with \* returns no matches while .\* does

**URL:** <https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394>\
**Category:** Elasticsearch\
**Created:** [October 23, 2014, 6:27am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394 "2014-10-23T06:27:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gargoyle\_2](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Gargoyle\_2](https://discuss.elastic.co/u/Gargoyle_2)\
**Post date:** [October 23, 2014, 6:27am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/1 "2014-10-23T06:27:24Z")

</div>

Hi,

I have a index of documents, where all string fields are not\_analyzed, and  
when I try to query by regex filter, I get a weird results:

{  
"size" : 1,  
"query" : {  
"filtered" : {  
"filter" : {  
"regexp" : {  
"name" : "v\*"  
}  
}  
}  
}  
}

returns no documents, however

{  
"size" : 1,  
"query" : {  
"filtered" : {  
"filter" : {  
"regexp" : {  
"name" : "v.\*"  
}  
}  
}  
}  
}

works fine - the only difference being the regexp "v\*" vs. "v.\*".

Thanks for any suggestion

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5671eaec-1ff5-4e63-b434-ec9d82a20fec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5671eaec-1ff5-4e63-b434-ec9d82a20fec%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ramy](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@Ramy](https://discuss.elastic.co/u/Ramy)\
**Post date:** [October 23, 2014, 7:24am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/2 "2014-10-23T07:24:51Z")

</div>

This is how regex works.  
v = The word must start with the character "v"  
. = Any character after "v"

- = Zero or more characters after "." till the end of the row

Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:

> Hi,
> 
> I have a index of documents, where all string fields are not\_analyzed, and  
> when I try to query by regex filter, I get a weird results:
> 
> {  
> "size" : 1,  
> "query" : {  
> "filtered" : {  
> "filter" : {  
> "regexp" : {  
> "name" : "v\*"  
> }  
> }  
> }  
> }  
> }
> 
> returns no documents, however
> 
> {  
> "size" : 1,  
> "query" : {  
> "filtered" : {  
> "filter" : {  
> "regexp" : {  
> "name" : "v.\*"  
> }  
> }  
> }  
> }  
> }
> 
> works fine - the only difference being the regexp "v\*" vs. "v.\*".
> 
> Thanks for any suggestion

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/44d071bb-f53d-4a4f-bd91-b53498738e0e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/44d071bb-f53d-4a4f-bd91-b53498738e0e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Gargoyle\_2](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Gargoyle\_2](https://discuss.elastic.co/u/Gargoyle_2)\
**Post date:** [October 23, 2014, 7:44am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/3 "2014-10-23T07:44:36Z")

</div>

Yes, I get that, but I do not get why "v\*" does not work, since that is  
"Word must start with 'v'"

On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:

> This is how regex works.  
> v = The word must start with the character "v"  
> . = Any character after "v"
> 
> - = Zero or more characters after "." till the end of the row
> 
> Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:
> 
> > Hi,
> > 
> > I have a index of documents, where all string fields are not\_analyzed,  
> > and when I try to query by regex filter, I get a weird results:
> > 
> > {  
> > "size" : 1,  
> > "query" : {  
> > "filtered" : {  
> > "filter" : {  
> > "regexp" : {  
> > "name" : "v\*"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > returns no documents, however
> > 
> > {  
> > "size" : 1,  
> > "query" : {  
> > "filtered" : {  
> > "filter" : {  
> > "regexp" : {  
> > "name" : "v.\*"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > works fine - the only difference being the regexp "v\*" vs. "v.\*".
> > 
> > Thanks for any suggestion

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4cc03086-9236-4495-bee8-261dd0ee3e37%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4cc03086-9236-4495-bee8-261dd0ee3e37%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ramy](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@Ramy](https://discuss.elastic.co/u/Ramy)\
**Post date:** [October 23, 2014, 7:58am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/4 "2014-10-23T07:58:23Z")

</div>

it would work if you have a word like: "vvvvvvvvvvvvvvv(n)"

Am Donnerstag, 23. Oktober 2014 09:44:36 UTC+2 schrieb Gargoyle:

> Yes, I get that, but I do not get why "v\*" does not work, since that is  
> "Word must start with 'v'"
> 
> On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:
> 
> > This is how regex works.  
> > v = The word must start with the character "v"  
> > . = Any character after "v"
> > 
> > - = Zero or more characters after "." till the end of the row
> > 
> > Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:
> > 
> > > Hi,
> > > 
> > > I have a index of documents, where all string fields are not\_analyzed,  
> > > and when I try to query by regex filter, I get a weird results:
> > > 
> > > {  
> > > "size" : 1,  
> > > "query" : {  
> > > "filtered" : {  
> > > "filter" : {  
> > > "regexp" : {  
> > > "name" : "v\*"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > returns no documents, however
> > > 
> > > {  
> > > "size" : 1,  
> > > "query" : {  
> > > "filtered" : {  
> > > "filter" : {  
> > > "regexp" : {  
> > > "name" : "v.\*"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > works fine - the only difference being the regexp "v\*" vs. "v.\*".
> > > 
> > > Thanks for any suggestion

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4fa7fb2e-cbf2-4f75-876f-efa461040e2b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4fa7fb2e-cbf2-4f75-876f-efa461040e2b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Gargoyle\_2](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@Gargoyle\_2](https://discuss.elastic.co/u/Gargoyle_2)\
**Post date:** [October 23, 2014, 8:07am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/5 "2014-10-23T08:07:00Z")

</div>

Oh, Thank You!

On Thursday, October 23, 2014 9:58:23 AM UTC+2, Ramy wrote:

> it would work if you have a word like: "vvvvvvvvvvvvvvv(n)"
> 
> Am Donnerstag, 23. Oktober 2014 09:44:36 UTC+2 schrieb Gargoyle:
> 
> > Yes, I get that, but I do not get why "v\*" does not work, since that is  
> > "Word must start with 'v'"
> > 
> > On Thursday, October 23, 2014 9:24:51 AM UTC+2, Ramy wrote:
> > 
> > > This is how regex works.  
> > > v = The word must start with the character "v"  
> > > . = Any character after "v"
> > > 
> > > - = Zero or more characters after "." till the end of the row
> > > 
> > > Am Donnerstag, 23. Oktober 2014 08:27:24 UTC+2 schrieb Gargoyle:
> > > 
> > > > Hi,
> > > > 
> > > > I have a index of documents, where all string fields are not\_analyzed,  
> > > > and when I try to query by regex filter, I get a weird results:
> > > > 
> > > > {  
> > > > "size" : 1,  
> > > > "query" : {  
> > > > "filtered" : {  
> > > > "filter" : {  
> > > > "regexp" : {  
> > > > "name" : "v\*"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > returns no documents, however
> > > > 
> > > > {  
> > > > "size" : 1,  
> > > > "query" : {  
> > > > "filtered" : {  
> > > > "filter" : {  
> > > > "regexp" : {  
> > > > "name" : "v.\*"  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > works fine - the only difference being the regexp "v\*" vs. "v.\*".
> > > > 
> > > > Thanks for any suggestion

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e68c32e2-f83c-4deb-8e53-98b18aa4b1a9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e68c32e2-f83c-4deb-8e53-98b18aa4b1a9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:54am UTC](https://discuss.elastic.co/t/regexp-with-returns-no-matches-while-does/20394/6 "2017-07-06T00:54:18Z")

</div>


