This action fetches all the matches of a regular expression pattern from an InputString and stores the array of all the matches into the specified key. The key value can be retrieved using the key name.
Regular expression patterns can be specified as a first parameter to fetch the required data from an input string. Take a look at some following scenarios to get better understanding about how this action works.
Scenario 1:
Objective:
Matching the beginning of the line.
Sign to be used to define Regular expression: ^
In this case, if user sets the regular expression as ^Qualitia, action will match the lines stating with the word Qualitia and stores them into the specified key.
Scenario 2:
Objective:
Matching the end of the line.
Sign to be used to define Regular expression: $
In this case, if user sets the regular expression as Qualitia$, action will match the lines ending with the word Qualitia and stores them into the specified key.
Scenario 3:
Objective:
Matching production, test, or demo instances.
Consider a scenario of a website example.com. This website is configured differently for production, test and demonstration environments. In this case, user needs to set the first variable as a regular expression as mentioned below:
(prod|test|demo)\.example\.com
Assumption: example.com does not change.
In case the input string does not match with regular expression, appropriate message is displayed in the Qualitia test execution report.
Scenario 4:
Objective:
Fetches the email address that is matching to the specified regular expression pattern.
In this case, if user sets the regular expression to find an email address with specific pattern, action will fetch such email addresses and stores under the specified key.
Regular Expression: ^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$