# A text replace node

**URL:** <https://community.n8n.io/t/a-text-replace-node/7405>\
**Category:** Feature Requests\
**Tags:** data-transformation, node\
**Created:** [August 23, 2021, 6:20am UTC](https://community.n8n.io/t/a-text-replace-node/7405 "2021-08-23T06:20:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [August 23, 2021, 6:20am UTC](https://community.n8n.io/t/a-text-replace-node/7405/1 "2021-08-23T06:20:47Z")

</div>

For me, it links back to this question

> [@Html suppress certain tags when extracting](http://community.n8n.io/t/html-suppress-certain-tags-when-extracting/7181/43):
>
> i think the issue is with the regex A | regex B using just one part of it seems to work. So the pipe | doesn’t seem to be taken into account EDIT: actually i think it only stripe out the first finding, not all of them from the content

But it would be handy to have a text replace node, that can take the text of the previous node and manipulate it however need, be that via a regex and delete, or match text and replace etc.

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [August 23, 2021, 6:43am UTC](https://community.n8n.io/t/a-text-replace-node/7405/2 "2021-08-23T06:43:18Z")

</div>

For now you can use script code (javascript) and replace text.

> **[String.prototype.replace() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)**
>
> The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match. If...

> **[String.prototype.replaceAll() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll)**
>
> The replaceAll() method of String values returns a new string with all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. The...

Or you can try out my pull request (warning its not complete finished, but i use it myself and it works)

> <https://github.com/n8n-io/n8n/pull/1426>
>
> \- From
> - Text
> - File (Binary)
> - With decode options see icon-v (utf8, bas…e64, utf16, etc...)
> - JSON
> \- To
> - Text
> - File (Binary)
> - With encode options see icon-v (utf8, base64, utf16, etc...)
> - JSON
> \- Get Manipulated Data (use previously manipulated)
> \- Skip Non-String
> \- Concat
> - Before
> - After
> \- Decode/Encode
> - see icon-v (utf8, base64, utf16, etc...)
> - with strip/add BOM
> \- Decode Entities
> -	Url
> - Xml
> - Legacy
> - Strict
> - Html
> - Legacy
> - Strict
> \- Encode Entities
> -	Url
> - Xml
> - Extensive
> - UTF8
> - NonAscii
> - Html
> - Extensive
> - UTF8
> - NonAscii
> \- Letter Case
> - Upper Case
> - Lower Case
> - Locale Upper Case
> - Locale Lower Case
> - Capitalize
> - Titlecase
> - Camel Case
> - Kebab Case
> - Snake Case
> - Start Case
> \- Replace
> - Substring
> - All
> - Regex
> - All
> \- Trim
> - Left
> - as an unit
> - Right
> - as an unit
> - Both
> - as an unit
> \- Pad
> - Start
> - End
> \- Substring
> - StartPosition
> - With
> - Complete
> - Position
> - Length
> \- Repeat
> - Times

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [August 23, 2021, 6:47am UTC](https://community.n8n.io/t/a-text-replace-node/7405/3 "2021-08-23T06:47:51Z")

</div>

yeah i know about that .replace etc, but if you look at the thread, sometimes its not that simple for all of us.

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [August 23, 2021, 7:13am UTC](https://community.n8n.io/t/a-text-replace-node/7405/4 "2021-08-23T07:13:49Z")

</div>

Therefore I have developed the TextManipulation node.  
It is currently far from perfect and needs a complete clean up.  
Since I didn’t have much time lately and also didn’t use n8n actively (due to private reasons) a lot of things fell by the wayside.  
In addition, I would like to wait with the further development, because I do not know exactly whether this node fits into n8n at all, since this already has a complexity size.  
Here is a small screenshot of how it would currently look.

 ![grafik](https://europe1.discourse-cdn.com/n8n/original/2X/2/2c63cc098beed3877c3fa4fb2cc965e51166420f.png)

---

<div class="post-metadata">

**Author:** ![igordisco](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/igordisco/32/7848_2.png) [@igordisco](https://community.n8n.io/u/igordisco)\
**Post date:** [December 15, 2021, 10:07pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/5 "2021-12-15T22:07:01Z")

</div>

Hey @lublak

How can i get this TextManipulation node?

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [December 17, 2021, 9:42am UTC](https://community.n8n.io/t/a-text-replace-node/7405/6 "2021-12-17T09:42:06Z")

</div>

@igordisco currenlty the node is avaible as pull request.  
It is up to the n8n team to decide if the node will be integrated into n8n.  
The node would still have to be tested a bit.  
If you want to have it, the easiest way would be to download the branch and start from that branch.  
I also merged it with the last point of n8n.  
If it is not accepted by n8n team, I will offer it as a single node via npm.

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [December 17, 2021, 9:54am UTC](https://community.n8n.io/t/a-text-replace-node/7405/7 "2021-12-17T09:54:07Z")

</div>

@RedPacketSec i added entities now the TextManipulation node.  
A few options can be added but the basic functionality exists.

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [December 17, 2021, 3:40pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/8 "2021-12-17T15:40:49Z")

</div>

Here is a full List of my pull request for the TextManipulation Node.  
If there is anything else, feel free to let me know. Generally speaking, I would consider it complete now.

```
From
    Text
    File (Binary)
        With decode options
    JSON
To
    Text
    File (Binary)
        With encode options
    JSON
Get Manipulated Data (use previously manipulated)
Skip Non-String
Concat
    Before
    After
Decode/Encode
    see icon-v (utf8, base64, utf16, etc...)
    with strip/add BOM
Decode/Encode Entities
    Url
    Xml
    Html
Letter Case
    Upper Case
    Lower Case
    Locale Upper Case
    Locale Lower Case
    Capitalize
    Titlecase
    Camel Case
    Kebab Case
    Snake Case
    Start Case
Replace
    Substring
    Regex
    Substring All
    Regex All
Trim
    Left
    Right
    Both
    Left as an unit
    Right as an unit
    Both as an unit
Pad
    Start
    End
Substring
    StartPosition
    With
        Complete
        Position
        Length
Repeat
    Times
```

---

<div class="post-metadata">

**Author:** ![Tyler-Intentflow](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tyler-intentflow/32/9522_2.png) [@Tyler-Intentflow](https://community.n8n.io/u/Tyler-Intentflow)\
**Post date:** [December 31, 2021, 12:16am UTC](https://community.n8n.io/t/a-text-replace-node/7405/9 "2021-12-31T00:16:59Z")

</div>

Split text would also be a valuable addition to what you’ve listed @lublak:

See the following UI example from Zapier:

 ![Split Text](https://europe1.discourse-cdn.com/n8n/original/2X/5/59c052d08374b8593e07f758426ec08d38045abf.png)

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [December 31, 2021, 1:17am UTC](https://community.n8n.io/t/a-text-replace-node/7405/10 "2021-12-31T01:17:34Z")

</div>

Welcome to the community @Tyler-Intentflow

Make sure you upvote the feature request.

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [December 31, 2021, 8:38am UTC](https://community.n8n.io/t/a-text-replace-node/7405/11 "2021-12-31T08:38:33Z")

</div>

I was already considering whether to include split and join in this node.  
Currently, all data is always from text to text.  
Split would be from text to array and join would be from array to text.  
Basically, of course, this can also be integrated here, but I am still undecided about this.  
I am currently planning another node that might be more suitable for this function. Which allows different combinations of the data structures.  
Currently it is rather difficult to work with nested structures. When it is ready, I will of course also make a pull request for it at n8n 🙂

---

<div class="post-metadata">

**Author:** ![Tyler-Intentflow](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tyler-intentflow/32/9522_2.png) [@Tyler-Intentflow](https://community.n8n.io/u/Tyler-Intentflow)\
**Post date:** [December 31, 2021, 4:25pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/12 "2021-12-31T16:25:36Z")

</div>

Great idea.  
By the way, I’m not finding the TextManipulator node in my instance.  
Is it in production? 🙂

---

<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:** [December 31, 2021, 4:32pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/13 "2021-12-31T16:32:56Z")

</div>

Looks like it is waiting for a review so it is not currently in n8n, depending on how comfortable you are with Git you could pull the change down and run it in your instance.

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [March 25, 2022, 7:17am UTC](https://community.n8n.io/t/a-text-replace-node/7405/14 "2022-03-25T07:17:34Z")

</div>

any update on this?

---

<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:** [March 25, 2022, 9:50am UTC](https://community.n8n.io/t/a-text-replace-node/7405/15 "2022-03-25T09:50:27Z")

</div>

Hey @RedPacketSec,

We are currently working through the PRs that improve existing nodes, Once we have dealt with those we will then start on new nodes. For now though if you wanted to use the text replace node you can build your own image and include it or you can extract the changes and add them to the custom node folder ([Configuration | Docs](https://docs.n8n.io/getting-started/installation/advanced/configuration.html#custom-nodes-location))

---

<div class="post-metadata">

**Author:** ![lublak](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lublak/32/9258_2.png) [@lublak](https://community.n8n.io/u/lublak)\
**Post date:** [August 1, 2022, 4:56pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/16 "2022-08-01T16:56:16Z")

</div>

@RedPacketSec some information from my side. Since n8n now allows an installaion of nodes directly from n8n. (official community nodes) I will be working on making this node available over the next few days.

---

<div class="post-metadata">

**Author:** ![RedPacketSec](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/redpacketsec/32/17523_2.png) [@RedPacketSec](https://community.n8n.io/u/RedPacketSec)\
**Post date:** [August 2, 2022, 5:21am UTC](https://community.n8n.io/t/a-text-replace-node/7405/17 "2022-08-02T05:21:24Z")

</div>

Ah cool, will try it out when back from holiday in a week or so

---

<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:** [August 2, 2022, 7:53am UTC](https://community.n8n.io/t/a-text-replace-node/7405/18 "2022-08-02T07:53:20Z")

</div>

Can’t wait to see it 😃

---

<div class="post-metadata">

**Author:** ![batistaamorem](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/batistaamorem/32/15975_2.png) [@batistaamorem](https://community.n8n.io/u/batistaamorem)\
**Post date:** [August 12, 2022, 1:35am UTC](https://community.n8n.io/t/a-text-replace-node/7405/19 "2022-08-12T01:35:34Z")

</div>

Aqui vai uma dica que pode ser útil dependendo do seu projeto.

remove todos os numeros e deixa somente texto  
{{$json[“body”][“app”][“data”][“message”][0][“value”].replace((/\d/g),“”)}}

separar texto e numero como array

{{$json[“body”][“app”][“data”][“message”][0][“value”].match(/\w/g)}}

separar somente numeros como array  
{{$json[“body”][“app”][“data”][“message”][0][“value”].match(/\d/g)}}

separar texto e numeros em blocos em array  
{{$json[“body”][“app”][“data”][“message”][0][“value”].match(/\w+/g)}}

remover numeros e filtrar somente palavras  
{{$json[“body”][“app”][“data”][“message”][0][“value”].replace((/\d+./g),“”)}}

---

<div class="post-metadata">

**Author:** ![djangelic](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/djangelic/32/9237_2.png) [@djangelic](https://community.n8n.io/u/djangelic)\
**Post date:** [August 15, 2022, 3:43pm UTC](https://community.n8n.io/t/a-text-replace-node/7405/20 "2022-08-15T15:43:58Z")

</div>

Your node is the first time I’m actually excited about the community nodes project! I think this node will be very useful!

[Next page](https://community.n8n.io/t/a-text-replace-node/7405.md?page=2)
