# Filebeat Regex problem - Escape pipe and colon

**URL:** <https://discuss.elastic.co/t/filebeat-regex-problem-escape-pipe-and-colon/62288>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [October 5, 2016, 3:34pm UTC](https://discuss.elastic.co/t/filebeat-regex-problem-escape-pipe-and-colon/62288 "2016-10-05T15:34:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neuronring](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neuronring/32/46713_2.png) [@neuronring](https://discuss.elastic.co/u/neuronring)\
**Post date:** [October 5, 2016, 3:34pm UTC](https://discuss.elastic.co/t/filebeat-regex-problem-escape-pipe-and-colon/62288/1 "2016-10-05T15:34:42Z")

</div>

I have configured filebeat on my windows server where i need to look for the lines matching the below pattern. Since the line itself has a pipe symbol "|" and a colon ":" the filebeat is considering it as OR condition and multi-line pattern for ":". But my regex has to match the whole string as it is..

```
modtransfer_2_1:reportResultCode | Result Description | strResultDescription : MOD TRANSFER FAILURE

```

This the text i need to look for in my log file. Please note the | (pipe) is not an OR condition and : (colon) does not mean anything. It is the actual text itself. I have my filebeat.yml configured like this.

```
  include_lines: ["('modtransfer_2_1\reportResultCode | Result Description | strResultDescription : MOD TRANSFER FAILURE')"]

```

But the filebeat treats each | separator as OR condition. How do i escape the pipe and colon ? Please assist.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 6, 2016, 1:21am UTC](https://discuss.elastic.co/t/filebeat-regex-problem-escape-pipe-and-colon/62288/2 "2016-10-06T01:21:07Z")

</div>

if possible do not use double quotes in yaml files when defining regular expressions (see filebeat FAQ section). yaml will treat the `\` character as escape character, which itself is the escape character for `|`. When using single quotes no escape character is required. Nevertheless use `\` to escape the pipe symbol.

---

<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:** [October 26, 2016, 3:34pm UTC](https://discuss.elastic.co/t/filebeat-regex-problem-escape-pipe-and-colon/62288/3 "2016-10-26T15:34:42Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
