The Text steps tidy and reshape text between apps: an order reference in capitals, a customer's name with the spaces trimmed, an email body without its HTML, the invoice number pulled out of a subject line. Each one is its own step, and none needs a connection.
Who can do this
Workspace Admins and Editors, on every plan.
The steps
| Step | What it does |
|---|---|
| Change case | lower case (the default), UPPER CASE, Title Case or Sentence case. |
| Trim | Removes spaces and line breaks at the start and end. With Also make spaces inside single on, every run of spaces or line breaks inside becomes one space. |
| Replace | Replaces words or a pattern — Every one or The first. |
| Split into a list | Turns text into a list at a Separator — a comma unless you give another. |
| Join a list | Turns a list into one text, with a Separator between each one — *, * unless you change it. |
| Extract with a pattern | Pulls out the part of text that matches a pattern (a regular expression): the first match and its groups, or every match with Every match on. |
| Find emails, web addresses or phone numbers | Lists every Emails, Web addresses or Phone numbers found in the text. |
| Make a slug | Northwind Logistics — Q4 report becomes northwind-logistics-q4-report, for an address or a file name. |
| Shorten | Cuts text to a length, at a word, with an ending — … unless you change it. |
| Pad | Fills text out to a length, at the start or the end — 42 to 00042. |
| Remove HTML | Keeps the words of an HTML text, a line for each paragraph. |
| Convert HTML to Markdown / Convert Markdown to HTML | Turns one into the other. |
| Count | Characters (the default), Words or Lines. |
Steps
- Select + where the text needs changing. In the step picker, open Utilities, select Text — No connection needed — then the step. Or search for the step's name, such as slug.
- In Text, put the value — drag it in from Data from earlier steps or use
{{ }}, such as{{ $json.subject }}. Join a list asks for List instead: a field that holds a list, such as{{ $json.tags }}. - Fill in the step's own settings:
- Change case — Case.
- Replace — Find: Text or A pattern; What to find, such as Ltd.; Replace with, such as Limited (Empty removes what was found. With a pattern, $1 puts back its first group.); and Replace: Every one or The first.
- Split into a list — Separator. A new line is written as a backslash and n —
\n. Trim each part, and drop empty ones is on unless you turn it off. - Join a list — Separator, between each one.
- Extract with a pattern — Pattern, such as
(?<invoice>INV-[0-9]+), and Every match. - Find emails, web addresses or phone numbers — Find: Emails, Web addresses or Phone numbers.
- Shorten — Longest, in characters, the ending included (140 unless you change it), and Ending.
- Pad — Length, With (one character,
0unless you change it), and At the: Start or End. - Count — Count: Characters, Words or Lines.
- In Put the result in, keep the suggested field name or type your own. The item's other fields are kept.
- Select Run this step, then check Output.
Output
The result goes under the field you named — by default text. Every other field on the item is kept; a field already called that is replaced. Split into a list and Find emails, web addresses or phone numbers give a list there; Count gives a number, under count by default.
Extract with a pattern gives the first match it finds as match (the whole match) and one field per group — a named group by its name, such as invoice for (?<invoice>INV-[0-9]+), and others as group1, group2. These go straight onto the item, whatever Put the result in says. With no match, match is empty, and a group that matched nothing is empty too. With Every match on, it gives a list of those, one for each match, under matches — or under the name in Put the result in, if you change it.
Good to know
- A pattern has 100 milliseconds per item. A pattern that takes longer stops the step rather than holding up the run; a simpler pattern almost always does the same job.
- Replace with a pattern can put a group back in the new text with
$1, or a named group with${invoice}. Replace with Text matches capitals exactly: Ltd. does not find LTD. - Find gives each one once, in the order found. Web addresses are those that start with
http://orhttps://. Phone numbers are found as written, with 7 to 15 digits; the step does not add a country code, so numbers written with+and their country code are the most useful. - Make a slug drops accents (é becomes e) and turns everything that is not a–z or 0–9 into a dash, so letters from other alphabets are left out.
- Shorten leaves text that already fits alone, and cuts at the last space when one is near the end. Pad leaves text that is already that long or longer alone.
- Count counts characters as people see them, so an emoji or an accented letter counts as one.
- Remove HTML drops scripts, styles and comments and reads entities such as
&. Convert Markdown to HTML shows any HTML in the text as text rather than passing it through, so it is safe to put in an email; it also makes tables and links. - A list or an object in Text is used as its JSON text. Use Join a list first, or Split Out to handle each value.
- It runs once per item.
If something goes wrong
| What the run says | Why | What to do |
|---|---|---|
| Pattern is not one this step can read: … | The regular expression has a mistake; the rest says where. | Correct the pattern; test it on one item with Run this step. |
| The pattern took longer than 100 ms on this item's text. Make it simpler — nested repeats such as (a+)+ are the usual cause. | It ran past 100 milliseconds on an item. | Make the pattern more specific, or split the text first. |
| Find is empty. Say what to replace. | What to find is empty. | Fill in What to find. |
| Pattern is empty when the step ran — an earlier step may not have given the value it names. | Extract with a pattern has no Pattern. | Write the pattern. |
| List is empty when the step ran — an earlier step may not have given the value it names. | List names a field the item does not have. | Check the step's Input; correct the field in {{ }}. |
| List is not a list. Choose a field that holds one — Split into a list makes one from text. | List holds text or a number, not a list. | Choose a field that holds a list, or use Split into a list first. |
| Length “…” is not a whole number from 1 to 100,000. (Shorten) / … from 1 to 10,000. (Pad) | Longest or Length is not a whole number in range. | Put a whole number in the box. |