# Regex conditional not working

**URL:** <https://discuss.elastic.co/t/regex-conditional-not-working/157094>\
**Category:** Logstash\
**Created:** [November 16, 2018, 3:13pm UTC](https://discuss.elastic.co/t/regex-conditional-not-working/157094 "2018-11-16T15:13:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_Leite](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/miguel_leite/32/41988_2.png) [@Miguel\_Leite](https://discuss.elastic.co/u/Miguel_Leite)\
**Post date:** [November 16, 2018, 3:13pm UTC](https://discuss.elastic.co/t/regex-conditional-not-working/157094/1 "2018-11-16T15:13:40Z")

</div>

Hey there guys!

I have a field with the following value:

`parsed_alert_txt => "ORA-06000: at "SYS.DBMS_QOPATCH", line 777"`

But this conditional doesn't seem to work, and I don't know why:

```
if [parsed_alert_txt] =~ /ORA-/ {
             mutate { add_tag => ["passed"] }
}

```

but it never tags the event, so I assume the regex conditional is not working. Can anyone help me?  
Thanks!

---

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [November 16, 2018, 7:30pm UTC](https://discuss.elastic.co/t/regex-conditional-not-working/157094/2 "2018-11-16T19:30:08Z")

</div>

Two suggestions...

I've had issues at times using [field] =~ value/regex, so try flipping it to `"ORA-" in [parsed_alert_txt]`

Second, define the regex just a little more clearly as `^ORA-.*`. What you have I imagine should work but this is an alternative to try.

---

<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 14, 2018, 7:30pm UTC](https://discuss.elastic.co/t/regex-conditional-not-working/157094/3 "2018-12-14T19:30:17Z")

</div>

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