Capitalize first word of one sentence

Dear n8n team,

I’m walking around to search for one solution to this problem:

I have several values in a json and I wanted to transform in order to get the first letter of each word in the sentence capitalize ussing some script.

#originalValues# ------------ #transformValues#
PEDRO lopez------------- Pedro Lopez
julian garcía mar------------ Julian García Mar
Miguel romero---------------- Miguel Romero

Please let me know if there is something not clear enought.

Thanks in advance for your time.

1 Like

Hi @MaaPer

Here is a sample workflow I have created to convert the given text into TitleCase.

1 Like

Thanks a lot. Even if the flow nodes are not showing properly on this feed, copying and paste into n8n work as I need.


1 Like

Glad it helps. Enjoy :slightly_smiling_face:

Is it / should it be possible to do this in an expression, in a set node, for example?

{{ $json["mytext"].replace(/(^\w|\s\w)/g, m => m.toUpperCase()) }}

I’m getting an error:

[missing ) after argument list]

With this form.

Hi guys, for anyone still having an issue with tis - thhere’s a community node now for this :


That’ll do the trick! +1 for inclusion in the base version!


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