# How to split text

**URL:** <https://community.n8n.io/t/how-to-split-text/21459>\
**Category:** Questions\
**Tags:** data-transformation, transform-string\
**Created:** [4 Enero, 2023 23:27 UTC](https://community.n8n.io/t/how-to-split-text/21459 "2023-01-04T23:27:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesar\_Contreras](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/cesar_contreras/32/20933_2.png) [@Cesar\_Contreras](https://community.n8n.io/u/Cesar_Contreras)\
**Post date:** [4 Enero, 2023 23:27 UTC](https://community.n8n.io/t/how-to-split-text/21459/1 "2023-01-04T23:27:09Z")

</div>

Hi there!  
I have this information:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/b/5/b579a3bd12f9a18f713d156d3517768a01073173.png)  
I want to split the text, somthing like  
Name: Test  
Email: [test@gmail.com](mailto:test@gmail.com)  
etc  
Its possible? I search some information, but I don´t know how to do, any information can help.  
Thanks!

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [5 Enero, 2023 12:16 UTC](https://community.n8n.io/t/how-to-split-text/21459/2 "2023-01-05T12:16:59Z")

</div>

Hi @Cesar_Contreras, welcome to the community!

Extracting information from a longer string including static portions of text is typically done using [regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions).

n8n allows you to execute JavaScript code which in turn gives you access to a number of methods supporting regular expressions. Here’s a quick example of how you could extract values from your example snippet:

To edit the regular expression I’ve used regex101: [regex101: build, test, and debug regex](https://regex101.com/r/fBSdOC/1). It’s probably not a great expression (I’ve seen much nicer ones here on the forum), but it’ll get the job done 🙂

This is the result:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/5/3/53e699980dec3ed1e70905673ab4b9fdc11cbf98.png)

---

<div class="post-metadata">

**Author:** ![Cesar\_Contreras](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/cesar_contreras/32/20933_2.png) [@Cesar\_Contreras](https://community.n8n.io/u/Cesar_Contreras)\
**Post date:** [7 Enero, 2023 03:19 UTC](https://community.n8n.io/t/how-to-split-text/21459/3 "2023-01-07T03:19:50Z")

</div>

Wow! thank you! works perfect, I try to do and works. And I can extract must of the text, but when try with the domain, show me error 🙃 also I import the data from gmail. the message afeter domain hace a date something like "Domain: [test.com](http://test.com): Date: 2022-05-12 but for some strange reason don´t show the day. Any Idea? so sorry for al incovenience I cause. I really appreciate the answer. Help me a lot.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [9 Enero, 2023 10:40 UTC](https://community.n8n.io/t/how-to-split-text/21459/4 "2023-01-09T10:40:15Z")

</div>

Hey @Cesar_Contreras,

it looks like the node is only told to return the 2 items so if you wanted Domain and Date you would need to update the regex pattern and return the updates results.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [9 Abril, 2023 10:40 UTC](https://community.n8n.io/t/how-to-split-text/21459/5 "2023-04-09T10:40:53Z")

</div>

Cerrado el 9 Abril, 2023 10:40 UTC

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