Skip to main content

Regular expressions in Pega Robot Studio

When working with user input data, you often need to validate that the user has input the correct type of data. For example, the system prompts a user to enter their email address, and you want to confirm that the email address is valid. Pega Robot Studio provides built-in methods, accessible from the Toolbox, to search and validate text using regular expressions.

Screenshot showing the regular expressions methods available from the Toolbox in Pega Robot Studio.

Regular expressions (regex) are a sequence of characters that specifies a search pattern in a string. Application of this search pattern includes validation of user input or finding and replacing text. Pega Robot Studio provides predefined methods for validation as well as methods for using custom regex matching.

Predefined methods

Pega Robot Studio provides out-of-the-box methods for matching email addresses, URLs, and IP addresses. These methods all take in a string value and return true if the string matches the pattern or false if it does not.

Method Description
HasEmailAddress Checks the entered string for an @ character and . character at the appropriate place for an email address.
HasUrl Checks the entered string to ensure it begins with http:// and contains a valid domain.
HasIPAddress Checks the entered string to match the format of a valid IP address.

Custom regex methods

Pega Robot Studio also provides methods that allow you to write and match your own regex. You can use custom regex to validate user input for which no predefined methods exist. For example, you prompt a user to input a social security number and use the IsRegexMatch method to check that the string matches the pattern of a social security number.

Pega Robot Studio also provides methods to modify an input string using regex. For example, you load data from a Microsoft Excel spreadsheet where one column has the city, state, and postal code in the same cell, such as Albany, GA 31707. Using the RegexSplit method, you can separate the single string containing all the data into separate strings for city/state and postal code: Albany, GA and 31707.

For more information about using regular expressions in Pega Robot Studio, see Commonly used Regex strings.

Check your knowledge with the following interaction.


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice