A text replace node

For me, it links back to this question

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.

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

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

3 Likes

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

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.

6 Likes

Hey @lublak

How can i get this TextManipulation node?

1 Like

@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.

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

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
1 Like

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

See the following UI example from Zapier:

2 Likes

Welcome to the community @Tyler-Intentflow

Make sure you upvote the feature request.

1 Like

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 :slight_smile:

2 Likes

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

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.

2 Likes

any update on this?

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)

@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.

10 Likes

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

Can’t wait to see it :smiley:

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),“”)}}

4 Likes

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

1 Like