Find Occurrences in Text
Verb: parseText
Finds the first occurrence of a value in a text, starting the search from a specified position.
Syntax
parseText --text(String) [--useRegex(Boolean)] --query(String) --regexPattern(String) [--regexOptions(DisplayableRegexOptions)] --startindex(Numeric) (Numeric)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--text | Text to Parse | Required | Text | Source text for analysis of occurrences. |
--useRegex | Use Regular Expression | Optional | Boolean | When enabled, searches for a value using a regular expression. |
--query | Text to Find | Only whenUse Regular Expression is False | Text | Value that should be searched for in the source text. |
--regexPattern | Regular Expression | Only whenUse Regular Expression is True | Text | Regular expression to search for the occurrence of the value. |
--regexOptions | Options | Optional | DisplayableRegexOptions | Regular expression options:
You can select one or more options. |
--ignorecase | Ignore case(Obsolete) | Optional | Boolean | When enabled, specifies case-insensitive matching.
This parameter is obsolete. To select regular expression options, use the Options instead. |
--dotmatchesnewline | Dot matches new line(Obsolete) | Optional | Boolean | When enabled, the dot (.) character matches every character, instead of every character except "\n".
This parameter is obsolete. To select regular expression options, use the Options instead. |
--freespacing | Ignore white space(Obsolete) | Optional | Boolean | When enabled, eliminates blank spaces and breaks without adding a escape character.
This parameter is obsolete. To select regular expression options, use the Options instead. |
--explicitcapture | Explicit capture(Obsolete) | Optional | Boolean | When enabled, specifies that the only valid captures are explicitly named or numbered groups of the form (?
This parameter is obsolete. To select regular expression options, use the Options instead. |
--multiline | Multiline(Obsolete) | Optional | Boolean | When enabled, changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string.
This parameter is obsolete. To select regular expression options, use the Options instead. |
--startindex | Position | Required | Number | Position in the text from which the search starts. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Index | Number | Returns the position of the first occurrence of the searched value. |
Example
The Find Occurrences in Text command finds "digital worker", starting search from position "1" in the source text, returning the starting position where the text was found.
defVar --name textToParse --type String --value "IBM Robotic Process Automation - Intelligent automation with a digital worker"
defVar --name textToFind --type String --value "digital worker"
defVar --name index --type Numeric
parseText --text "${textToParse}" --query "${textToFind}" --startindex 1 index=value
logMessage --message "Found text at position: ${index}" --type "Info"
// This example produces the following result:
// Found text at position: 64.