# RegEx for URI field

**URL:** <https://discuss.elastic.co/t/regex-for-uri-field/207779>\
**Category:** Kibana\
**Created:** [November 13, 2019, 9:31pm UTC](https://discuss.elastic.co/t/regex-for-uri-field/207779 "2019-11-13T21:31:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AshishC](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishc/32/45312_2.png) [@AshishC](https://discuss.elastic.co/u/AshishC)\
**Post date:** [November 13, 2019, 9:31pm UTC](https://discuss.elastic.co/t/regex-for-uri-field/207779/1 "2019-11-13T21:31:24Z")

</div>

Hi Team,

Regular expression to search all the documents with following URL ( have shown 3 docs here)

@fields.requested\_uri: "/services/chinesedrugcontent/drugTopics/3492/json"  
@fields.requested\_uri: "/services/chinesedrugcontent/drugTopics/434/json"  
@fields.requested\_uri: "/services/chinesedrugcontent/drugTopics/3393422/json"

Search Queries

Qeury 1: Using double quotes ""  
@fields.requested\_uri: "/services/chinesedrugcontent/drugTopics/3492/json"  
Return: All the documents consisting of exact URL as mentioned in the query

Query 2: Using forward slash //  
@fields.requested\_uri: /services/chinesedrugcontent/drugTopics/3492/json/  
Return: All the documents consisting of terms mentioned in the query like services, chinesedrugcontent etc

Query 3: RegEx  
Form 1: Using ""  
@fields.requested\_uri: "/services/chinesedrugcontent/drugTopics/[0-9]+/json"  
Form 2: Using //  
@fields.requested\_uri: /services/chinesedrugcontent/drugTopics/[0-9]+/json/  
@fields.requested\_uri: /services/chinesedrugcontent/drugTopics//[0-9]+//json/

Returns: Nothing , none of the above 3 queries works

How to use regex in Kibana? Details given is the following page is not working for some reasons

[https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html)

As per above link, To use reserved keywords as literally, escape it with a preceding backslash or surround it with double quotes. For example:

@ # renders as a literal '@'  
\ # renders as a literal ''  
"[john@smith.com](mailto:john@smith.com)" # renders as 'john@smith.com'

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [November 18, 2019, 8:37pm UTC](https://discuss.elastic.co/t/regex-for-uri-field/207779/2 "2019-11-18T20:37:30Z")

</div>

Kibana doesn't allow for regex queries. That guide is for regex queries when sending direct requests to ES. For kibana syntax look for KQL and/or Lucene search syntax.

---

<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:** [December 16, 2019, 8:37pm UTC](https://discuss.elastic.co/t/regex-for-uri-field/207779/3 "2019-12-16T20:37:31Z")

</div>

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