# Special characters in regex pattern

**URL:** <https://discuss.elastic.co/t/special-characters-in-regex-pattern/213380>\
**Category:** Logstash\
**Created:** [December 30, 2019, 9:03pm UTC](https://discuss.elastic.co/t/special-characters-in-regex-pattern/213380 "2019-12-30T21:03:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Andrews](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremy_andrews/32/60104_2.png) [@Jeremy\_Andrews](https://discuss.elastic.co/u/Jeremy_Andrews)\
**Post date:** [December 30, 2019, 9:03pm UTC](https://discuss.elastic.co/t/special-characters-in-regex-pattern/213380/1 "2019-12-30T21:03:48Z")

</div>

I’m trying to write an if statement in Logstash to check if the message starts with a certain pattern, but Logstash crashes without any useful reason given in the log. I’m wondering if I’m not escaping the special character properly? Do you notice anything wrong with this line? I’m trying to drop any log which begins with \</System

`if [message] =~ /^<\/System/ { drop {} }`

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [December 30, 2019, 9:40pm UTC](https://discuss.elastic.co/t/special-characters-in-regex-pattern/213380/2 "2019-12-30T21:40:00Z")

</div>

> [@Jeremy\_Andrews](#):
>
> Logstash crashes without any useful reason given in the log

What does it log?

---

<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:** [January 27, 2020, 9:40pm UTC](https://discuss.elastic.co/t/special-characters-in-regex-pattern/213380/3 "2020-01-27T21:40:01Z")

</div>

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