# How to check if then else whether nummeric between 2 signs of a string

**URL:** <https://discuss.elastic.co/t/how-to-check-if-then-else-whether-nummeric-between-2-signs-of-a-string/236310>\
**Category:** Logstash\
**Created:** [June 9, 2020, 10:07am UTC](https://discuss.elastic.co/t/how-to-check-if-then-else-whether-nummeric-between-2-signs-of-a-string/236310 "2020-06-09T10:07:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Datakids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/datakids/32/39622_2.png) [@Datakids](https://discuss.elastic.co/u/Datakids)\
**Post date:** [June 9, 2020, 10:07am UTC](https://discuss.elastic.co/t/how-to-check-if-then-else-whether-nummeric-between-2-signs-of-a-string/236310/1 "2020-06-09T10:07:36Z")

</div>

Hi there,

I have this in my logs:

check code '' is relevant  
check code '589' is relevant

What I want to do in logstash:

```
if [field] !~ check code '/^[0-9]+$/' is relavant! 
    {
    		mutate {
    			update => {"status" => "relevant"}
    		}
    else 
    	{
    		mutate {
    			update => {"status" => "not relevant"}
    		}
    	}
    }

```

Will this work ?  
Thanks for your help  
Regards

---

<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:** [July 7, 2020, 10:07am UTC](https://discuss.elastic.co/t/how-to-check-if-then-else-whether-nummeric-between-2-signs-of-a-string/236310/2 "2020-07-07T10:07:41Z")

</div>

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