Extract Email Address
Extracts one or more email addresses from a text.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Extracts one or more email addresses from a text.
The results that this command returns might vary according to the selected NLP provider. For more information, see Setting an NLP provider.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
extractEmail --culture(Culture) --text(String) (List<String>)=values (String)=first (DataTable)=valuesmapping (Boolean)=success
Input parameter
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Language | culture |
Required |
Text, Culture |
Language that defines the text culture. If you define the language manually, make sure to enter only supported language codes. See the culture parameter options for supported
languages.Remember:The language does not affect how the command works. It is only used to set in which language an error will be returned.
|
Text | text |
Required |
Text |
Text that contains the email address. |
culture
parameter options
The following table displays the options available for the culture
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description | Supported provider |
---|---|---|---|
ar |
ar |
Arabic | Watson NLP |
zh-CN |
zh-CN |
Chinese (Simplified) | Watson NLP |
zh-TW |
zh-TW |
Chinese (Traditional) | Watson NLP |
cs |
cs |
Czech | Watson NLP |
da |
da |
Danish | Watson NLP |
nl |
nl |
Dutch | Watson NLP |
de-DE |
de-DE |
German | Watson NLP |
en-US |
en-US |
English | Legacy and Watson NLP |
fi |
fi |
Finnish | Watson NLP |
fr-FR |
fr-FR |
French (France) | Watson NLP |
fr-CA |
fr-CA |
French (Canada) | Watson NLP |
he |
he |
Hebrew | Watson NLP |
it-IT |
it-IT |
Italian | Watson NLP |
ja-JP |
ja-JP |
Japanese | Watson NLP |
ko-KR |
ko-KR |
Korean | Watson NLP |
nb |
nb |
Norwegian Bokmal | Watson NLP |
nn |
nn |
Norwegian Nynorsk | Watson NLP |
pt-BR |
pt-BR |
Portuguese (Brazil) | Legacy and Watson NLP |
pt-PT |
pt-PT |
Portuguese (Portugal) | Legacy and Watson NLP |
pl |
pl |
Polish | Watson NLP |
ro |
ro |
Romanian | Watson NLP |
ru-RU |
ru-RU |
Russian | Watson NLP |
sk |
sk |
Slovak | Watson NLP |
es-ES |
es-ES |
Spanish | Watson NLP |
sv |
sv |
Swedish | Watson NLP |
tr |
tr |
Turkish | Watson NLP |
Output parameter
|Designer mode label|Script mode name|Accepted variable types|Description| |---|---|---|---|---| |Values|
values
|List<Text>
|List of emails extracted.| |First value|first
|Text
|First email extracted.| |Values mapping|valuesmapping
|Data Table
|Data table with extracted
values mapped by rows and columns.
See the valuesmapping
parameter section for details.| |Success|
success
|Boolean
|Returns True if the email was successfully extracted or False otherwise.|
valuesmapping
parameter options
This parameter returns a data table with details of the extracted values.
The following list shows the mapped values:
- The index of the email address in the list of extracted values. Index values start at 1.
- The index in characters where the email address is found in the text.
- The length of the text used to extract the email address.
- The text used to extract the email address and the email address itself.
Example
The following example extract emails from alleged clients and store the results in variables.
defVar --name emails --type String --value "Customer 1, Email: randomcustomer1@random.com\r\nCustomer 2, Email: randomcustomer2@random.com\r\nCustomer 3, Email: randomcustomer3@random.com"
defVar --name emailsList --type List --innertype String
defVar --name firstValue --type String
defVar --name success --type Boolean
extractEmail --culture en-US --text "${emails}" emailsList=values firstValue=first success=success
logMessage --message "Email list: ${emailsList}\r\nFirst Email Found: ${firstValue}\r\nResult: ${success}\r\n" --type "Info"
// Email list: [randomcustomer1@random.com,randomcustomer2@random.com,randomcustomer3@random.com]
// First Email Found: randomcustomer1@random.com
// Result: True