STR Between

<< Click to Display Table of Contents >>

Navigation:  Actions > Strings >

STR Between

This action cuts a substring that is enclosed by two sequences of characters out of the source string.

Suppose we have the following string:

 

<h3><b>Another news - at last week</b></h3>

 

We need to cut the meaningful string out, i.e. the string between the HTML tags. It is easy with the STR Between action. To do it, you should create the limiting sequences of characters:

Start - <h3><b>

End - </h3></b>

The action cuts the string between the start and end marks out and assigns the result to a custom variable for further processing. If at least one mark is not found in the source string, the action will return an empty string.

 

STRBetween

Source String

Specify the source string to be processed. It is possible to use variables.

 

Begin Mark

The start mark of the substring. It is possible to use variables

 

End Mark

The end mark of the substring. It is possible to use variables

 

Case Sensitive

You can make the search for the substring case-sensitive. By default, the search for the substring is case-insensitive.

 

Start Position

The position of the character the search will be started from. Number 1 corresponds to the beginning of the string. If the number is greater than the length of the string, the action will return en empty result. It is possible to use variables.

 

Assign Result to Variable

Enter the name of the custom variable to assign the result to.

 

Save Next Start Position to Variable

If necessary, you can specify the name of the variable you can assign the start position for the next substring search to. If we reach the end of the string, the next start position will be equal to 0.

It is necessary, for example, in order to get all substrings meeting the specified criteria in the source string.

Suppose we need to get all substrings enclosed by parentheses in the following string:

 

Just (a few minutes) with RoboTask will give you (plenty of ideas) of how you can (increase) your productivity

 

You can easily do it using a loop. See the following example: "[DEMO] STR Between - extract all entries"

 

Variable

Allows you to add a variable to the action or triggering event that you selected. You must place the cursor in a edit box in the settings dialog window of the action or event and then click the {V} button.

 

note Related Topics

STR Replace

STR Trim

STR Delete

STR Insert

STR Extract

STR Pos

STR Length

STR format CSV line

TXT Number of Lines

TXT Extract Line

TXT Delete line

TXT Insert line

TXT Comma-Text Conversion

TXT UTF-8 Conversion

Operations on lists