# Gsub specific characters but not all of them in value

**URL:** https://discuss.elastic.co/t/gsub-specific-characters-but-not-all-of-them-in-value/53909
**Category:** Logstash
**Created:** [June 24, 2016, 4:22pm UTC](https://discuss.elastic.co/t/gsub-specific-characters-but-not-all-of-them-in-value/53909 "2016-06-24T16:22:16Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [June 30, 2016, 7:21am UTC](https://discuss.elastic.co/t/gsub-specific-characters-but-not-all-of-them-in-value/53909/4 "2016-06-30T07:21:26Z")

</div>

You'll have to use a ruby filter for that. Something similar to

```nohighlight
ruby {
  code => "
    event.to_hash.each { |k, v|
      event[k] = v.to_f if k.start_with? 'metric-'
    }
  "
}

```

should work.

---

_[View the full topic](https://discuss.elastic.co/t/gsub-specific-characters-but-not-all-of-them-in-value/53909)._
