Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Please read the Terms of Use for Materials on ZennoLab |
Table of contents
Expand | ||||
---|---|---|---|---|
| ||||
|
...
Description
This block serves various manipulations with text, which are very often required in practice. Process the parsed text, clean it of garbage, translate it into other languages - all this, and much more, can be done by a text processing "cube".
...
Via context menu Add Action -> Data -> Text Processing
...
Or use smart search.
Where is word processing applied?
Escape strings . To escape special characters
Regex. Regular expression search for text
Spintax. Randomize, uniqueize text
Split. Split a string into several others using a separator
ToChar. Convert Unicode code to character
ToLower, ToUpper. Convert uppercase letters to lowercase and vice versa
Trim. Clear text from extra whitespace characters
UrlEncode, UrlDecode. Encode \ Decode URL
Into To a variable, list, table . Put data in variable, list or table
Replacement . Replace text
Translation . Perform translation into another language
Preparing JavaScript . Process text for use in a Logic (IF-ELSE) or JavaScript action
Transliteration . Make text transliterated
...
The properties window consists mainly of three areas:
The input string is text, a variable, or a combination of both.
Actions on the string, properties and their settings.
The output string (result) in a variable.
...
Info |
---|
Set the cursor in the input line area, press Ctrl + Space and select useful constants and project variables from the drop-down list. For example, this way you can quickly insert a proxy of the project |
...
All possible operations with this "cube":
...
Escaping sequences. This action replaces the characters * +? | {[() ^ $. #
(places a "slash" in front of each specified character -\
) This technique is often used to work with queries and for the regex engine to use these characters literally, rather than as commands or metacharacters.
...
In this field, you must enter a regular expression, which will be used to search the text. Example -(?<=<title>).*(?=</title>)
Regular Expression Tester can help you in writing regular expressions
...
Expand | |||||
---|---|---|---|---|---|
| |||||
Let's imagine that there is the following text:
And the task is to disassemble it into its components. To do this, we will use the following regular expression: This is how the output looks in the Regular Expression Tester: Let's imagine that we need to take in variables the day, month and year from the second row. Here's how you can do it: The match number in our case is the line number. Because the numbering here starts from zero, then in order to take the second line, we indicate 1 Next, you need to specify the group number and the variable to which the result will be saved. Here, too, the numbering of groups starts from zero. But group 0 contains the entire found line ( |
...
It is very similar to the previous function (To variables) with the difference that not one result is saved here, but everything is stored in a table. You can exclude some of the groups found from the final result.
Expand | |||||
---|---|---|---|---|---|
| |||||
We use the same text:
Our task is to parse it and save it to a table. To do this, we will use the following regular expression: This is how the output looks in the Regular Expression Tester: Let's also imagine that we don't need seconds and milliseconds in the final table. This is how it might look: The group under index 0 contains the entire match (in our case, the string), so we exclude it. In groups 6, 7 - seconds and milliseconds, respectively. |
...
Let's look at a specific example - parsing links with regular expressions, composed using a tester.
For example, we have a task - to get links to the profiles of active users of the ZennoLab forum. Let's get started:
...
With the help of the cube Get value, we get the HTML code of the element in which links to users who are online on the forum are posted.
Add the “Regex” action. To compose the pattern used in the properties of the “Regex” action, use the Regular Expression Tester.
Add the “html“ variable to the input in the action properties, and save the result to the “urls” list.
After running the cube, we get unique id in the list, which can be used to form the URL of user profiles.
...
Spintax
Randomization or uniqueness of text. With the help of spintax it is convenient to create synonymization of texts. Spinax is a construction of curly braces and vertical slashes that allows you to randomly substitute substrings from a string. In its simplest form, the spintax looks like this: {variant1 | variant2 | variant3}
. When executing this action, one of the three options will accidentally fall into the resulting variable.
...
Converts an integer value to Unicode characters .
Each Unicode character has its own numeric code and this functionality allows you to convert a numeric value to the corresponding characters. For example, the symbol ♛
has a numeric value 9819
...
Replaces all uppercase characters in the text with lowercase.
It was | Has become |
---|---|
CHANGES REGISTER OF LETTERS TO LOWER | changes the case of letters to lowercase |
Beginning of words
Changes the case to lowercase for the first character of each word in the text.
It was | Has become |
---|---|
CHANGES REGISTER OF LETTERS TO LOWER | cHANGES rEGISTER oF lETTERS tO lOWER |
The first character
Changes the case of only the first character in the specified text.
It was | Has become |
---|---|
CHANGES REGISTER OF LETTERS TO LOWER | cHANGES REGISTER OF LETTERS TO LOWER |
...
ToUpper
...
Changes the case of letters to uppercase depending on the selected property. For example, let's take a string lowercase text
...
Replaces all lowercase characters in the text with uppercase.
It was | Has become |
---|---|
lowercase text | LOWER CASE TEXT |
Beginning of words
Changes the case of the first character of each word in the text to uppercase.
It was | Has become |
---|---|
lowercase text | Lower Case Text |
The first character
Changes the case of only the first character in the specified text.
It was | Has become |
---|---|
lowercase text | lower case text |
...
Trim
This function is used to remove extra characters at the beginning and \ or end of the passed string.
...
Decodes an UrlEncode encoded string (described below).This action looks most obvious when decoding the Cyrillic alphabet:
Was: % D0% 9F% D1% 80% D0% B8% D0% B2% D0% B5% D1% 82% 2C% 20% D0% BC% D0% B8% D1% 80% 21
.
Was: Hello+G%c3%bcnter!
It became: Hello worldGünter!
...
UrlEncode
Only Latin letters, numbers and a few punctuation marks are allowed in the URL. All other characters that are transmitted in the HTTP request must be encoded using UrlEncode, otherwise the server may misinterpret the request.
...
This action splits the text using the specified in the properties of the separator into lines and writes them to the list.
Separator
Enter - newline character
Space
Custom text - here you can specify both a single character (for example
;
) and several characters (note: if you specify several characters here, they will be considered as one separator!)Custom Regex - using regular expression .
...
To table
This action splits the transmitted text into rows and columns (according to the specified separators) and places the data into a table.
Separators
Enter - newline character
Space
Custom text - here you can specify both a single character (for example
;
) and several characters (note: if you specify several characters here, they will be considered as one separator!)Custom Regex - using regular expression.
...
Replace
...
This action searches the string for a substring, replaces it with another, and then saves the result to a variable.
...
The substring to find (or a regular expression if the Regex search type is selected).
...
Here you need to select the service through which the transfer will be carried out. Available options:
API keys for services can be added in ZennoPoster settings.
Source language, Target language
...
Here are some examples: English - en, Spanish - es, German - de, Russian - ru (full list)ll list)
Note |
---|
Language codes may differ from service to service. For a complete and reliable list of codes, you should refer to the documentation of the selected service. |
...
Processes a string for correct use in JavaScript. Mostly escapes quotes and other specials. symbols. This macro prepares text so that it can be inserted as a string in a JavaScript or IF action. ProjectMaker has a JavaScript tester where you can inspect (test) your code. This "cube" will help you to escape quotes, apostrophes and other special characters.
...
Takes a piece of text from a string specified in the action properties by two indices - from one character to another. For example, if you take the first sentence of this paragraph and there is a task to get a substring in it from 95 106 characters to the end of the text, then we get “to another.”.
...
Transliteration
Sometimes it is still required to perevesti ( to translate) Cyrillic to Latin. This action also serves write Cyrillic words using Latin alphabet. You can do it with this action.
...