# Processor.regex.fields --\> pattern & replacement --\> default value if not match needed

**URL:** <https://community.influxdata.com/t/processor-regex-fields-pattern-replacement-default-value-if-not-match-needed/17243>\
**Category:** Telegraf\
**Tags:** telegraf\
**Created:** [December 16, 2020, 12:42pm UTC](https://community.influxdata.com/t/processor-regex-fields-pattern-replacement-default-value-if-not-match-needed/17243 "2020-12-16T12:42:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iban\_Garcia](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/iban_garcia/32/3339_2.png) [@Iban\_Garcia](https://community.influxdata.com/u/Iban_Garcia)\
**Post date:** [December 16, 2020, 12:42pm UTC](https://community.influxdata.com/t/processor-regex-fields-pattern-replacement-default-value-if-not-match-needed/17243/1 "2020-12-16T12:42:28Z")

</div>

I have a working telegraf --\> processor.regex.fields config.  
So, I search for a regex pattern and y apply a replacement:  
[[processors.regex.fields]]  
key = “message”  
pattern = ‘(.\*?)(&submode=)([^\s\&]+)([^]+)’  
replacement = “${3}”  
result\_key = “submode”

Everythink works great but… sometimes no “submode=” chain is present in message and I need a “default” value to be inserted in the influxdb…

Is there any way to apply a default value when there is no match?

Many Thanks in advance!!

Iban
