# Regex not working

**URL:** <https://discuss.elastic.co/t/regex-not-working/81481>\
**Category:** Elasticsearch\
**Created:** [April 6, 2017, 1:59pm UTC](https://discuss.elastic.co/t/regex-not-working/81481 "2017-04-06T13:59:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gongzt](https://avatars.discourse-cdn.com/v4/letter/g/e79b87/32.png) [@gongzt](https://discuss.elastic.co/u/gongzt)\
**Post date:** [April 6, 2017, 1:59pm UTC](https://discuss.elastic.co/t/regex-not-working/81481/1 "2017-04-06T13:59:38Z")

</div>

We are trying to match following content using regex query:  
**SRVE0293E: [Servlet Error]-[action]: java.lang.NullPointerException**  
Where SRVE0293E, Servlet Error, java.lang.NullPointerException are the keywords.

We tried a lot of different patterns but still not able to get a correct one, here is one of the queries we have tried:  
{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"must": [  
{  
"query\_string": {  
"default\_field": "fields.subType",  
"query": "ewpCore"  
}  
},  
{  
"regexp": {  
"message": ".\*srve0293e.\*nullpointerexception"  
}  
}  
]  
}  
}  
}  
}  
}

Please kindly help to get the correct regex, thanks in advance!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 6, 2017, 2:42pm UTC](https://discuss.elastic.co/t/regex-not-working/81481/2 "2017-04-06T14:42:13Z")

</div>

Don't analyze the String if you really want to use regex.

---

<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:** [May 4, 2017, 2:42pm UTC](https://discuss.elastic.co/t/regex-not-working/81481/3 "2017-05-04T14:42:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
