# My regExp doesn't work in mutate gsub

**URL:** <https://discuss.elastic.co/t/my-regexp-doesnt-work-in-mutate-gsub/305657>\
**Category:** Logstash\
**Created:** [May 26, 2022, 5:18am UTC](https://discuss.elastic.co/t/my-regexp-doesnt-work-in-mutate-gsub/305657 "2022-05-26T05:18:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![playingkim0916](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/playingkim0916/32/106170_2.png) [@playingkim0916](https://discuss.elastic.co/u/playingkim0916)\
**Post date:** [May 26, 2022, 5:18am UTC](https://discuss.elastic.co/t/my-regexp-doesnt-work-in-mutate-gsub/305657/1 "2022-05-26T05:18:31Z")

</div>

The value value of [@metadata][test] is 2022-05-24T08:50:05.000Z , but using the corresponding regular expression causes an error  
error msg is  
Failed to execute action {:action=\>LogStash::PipelineAction::Create/pipeline\_id:main, :exception=\>"LogStash::ConfigurationError", :message=\>"Expected one of [\t\r\n], "#", "-", [0-9], [A-Za-z\_], '"', "'", "}" at line 156, column 3 (byte 5114) after filter  
My regEx is [^0-9^A-][0-9][0-9A-Z]+  
and this is my gsub  
// gsub =\> {  
["[@metadata][test]", "[^0-9A-][0-9][0-9A-Z]+", ""]  
}  
And I want to change the value to YYYY-MM-dd format, is there a better way?

---

<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:** [May 26, 2022, 4:10pm UTC](https://discuss.elastic.co/t/my-regexp-doesnt-work-in-mutate-gsub/305657/2 "2022-05-26T16:10:52Z")

</div>

What is the complete error message and what is the logstash configuration file?

---

<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:** [June 23, 2022, 4:11pm UTC](https://discuss.elastic.co/t/my-regexp-doesnt-work-in-mutate-gsub/305657/3 "2022-06-23T16:11:12Z")

</div>

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