# Separate country code from phone number

**URL:** https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075
**Category:** Logstash
**Created:** [June 17, 2019, 1:34pm UTC](https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075 "2019-06-17T13:34:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Andreasky](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Andreasky](https://discuss.elastic.co/u/Andreasky)
#### Post date: [June 17, 2019, 1:34pm UTC](https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075/1 "2019-06-17T13:34:21Z")

</div>

How can I separate the country code from a phone number?

I want +4712345678 to be separated into two terms: "country code" =\> "+47", "phone number" =\> "12345678"

---

<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: [June 17, 2019, 3:08pm UTC](https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075/2 "2019-06-17T15:08:15Z")

</div>

See [this](https://discuss.elastic.co/t/logstash-link-fileds-in-aggregate-filter/167272/2) post. You would need to re-write (in ruby) the code that is linked to.

---

<div class="post-metadata">

### Author: ![Andreasky](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Andreasky](https://discuss.elastic.co/u/Andreasky)
#### Post date: [June 21, 2019, 12:56pm UTC](https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075/3 "2019-06-21T12:56:23Z")

</div>

Thank you!

---

<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 19, 2019, 12:56pm UTC](https://discuss.elastic.co/t/separate-country-code-from-phone-number/186075/4 "2019-07-19T12:56:28Z")

</div>

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