Text tools
Split, join, replace, change case, measure, encode, hash or convert a piece of text.
In both apps
WarpX Browser
WarpX Phone
Text tools does the small jobs between two blocks: split an email|password|2fa line into three variables, tidy up text read from a page, encode a value for an address, hash it, or turn JSON text into data. Pick an action, give it the text or a reference to it, and store the result.
Settings
- Description
A note shown on the block in the canvas.
ExampleAccount line- Action
Split, Join a list, Replace, Trim spaces, UPPER CASE, lower case, Capitalize Each Word, Length, URL encode, URL decode, Base64 encode, Base64 decode, MD5 hash, SHA-1 hash, SHA-256 hash, Text to JSON or JSON to text.
ExampleSplit- Text
The text to work on, usually a reference such as
{{variables.pageTitle}}or{{loopData.accounts}}. A list or an object is turned into JSON text first, except for Join a list and JSON to text.Example{{loopData.accounts}}- Delimiterwhen Action is Split or Join a list
What to split at, or to put between the items when joining. Write
\nfor a new line and\tfor a tab.Example|- Into variables (optional)when Action is Split
Names separated by commas. The first piece goes into the first variable, the second into the second, and so on; a name with no piece left gets empty text.
Exampleemail, password, twoFa- Findwhen Action is Replace
The text to find. Every occurrence is replaced.
Example\s+- Replace withwhen Action is Replace
What to put in its place; empty removes it.
\nand\twork here too.Example- Find is a regular expressionwhen Action is Replace
Read Find as a regular expression, matched everywhere in the text and case-sensitively.
ExampleChecked- Assign to variable
Store the whole result in a variable. For Split that is the list of pieces, in addition to any named variables.
ExampleUnchecked- Variable namewhen Assign to variable is ticked
The variable that receives the result.
Examplepieces
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
The result goes on as {{prevBlockData}}, and to the variable when one is named: a list for Split, a number for Length, data for Text to JSON, text for everything else. With Into variables (optional) filled in, each piece is also its own variable, such as {{variables.email}}.
Example: Sign in with accounts read from an email|password|2fa file
- Start
- Insert data
- Text tools
- Loop data
- Text tools
- Forms
- Get OTP
- Loop breakpoint
- Add an Insert data block with a Variable row named
accountsTextwhose value is read from the fileC:\Users\you\Documents\accounts.txtwith File Action Default. - Add a Text tools block: Action Split, Text
{{variables.accountsText}}, Delimiter\n, Assign to variable ticked and namedaccounts. - Add a Loop data block: Loop through Variable, Variable name
accounts, Loop IDaccounts. - Inside the loop add a second Text tools block: Action Split, Text
{{loopData.accounts}}, Delimiter|, Into variables (optional)email, password, twoFa. - Fill the login form with Forms blocks using
{{variables.email}}and{{variables.password}}, and get the code with Get OTP from{{variables.twoFa}}. - Close the loop with a Loop breakpoint whose Loop ID is
accounts.
Good to know
- Splitting at
\nhandles files saved on Windows too: the carriage return Windows puts before each new line is dropped with it, so the last piece of a line (often a 2FA secret) carries no invisible character. - A file that ends with a new line gives an empty last piece, and the loop gets an empty last item.
- Join a list takes a list, JSON text of a list, or text with one item per line.
- Capitalize Each Word lowercases the rest of each word:
mcDONALDbecomesMcdonald. - Length counts characters rather than bytes, so an accented letter or most emoji count as one.
- Base64 decode also accepts the URL-safe alphabet. Hashes come out as lowercase hex.
- Text to JSON fails on text that is not valid JSON. JSON to text on plain text gives it in quotes.
See also
- RegEx variable — Replace a text variable with what a regular expression matches, or with a replaced version.
- Loop data — Run the blocks after it once for each row, number, list item or element.
- Get OTP — Work out the current 6-digit two-factor code from its secret.