Regular Expression to Extract the First Part of a URL in Nintex Workflow

Using the Regular Expression action in Nintex Workflow, you can extract the first part of a URL and store it in a workflow variable to use in the rest of the workflow.

Follow these steps to build out this functionality:

  1. Add a Regular Expression action to the workflow.
  2. Configure the action with the following options:
    • Pattern = See examples in the table below
    • Ignore case = Check if string case should be ignored
    • Operation = Extract
    • Input text = URL string to extract data from (can be hard coded or inserted from the Insert Reference button)
    • Store result in = Create a “Single line of text” variable to use.
      • Note: The result is stored in a Collection variable. You will need to add another action like the “Collection Operation” action to get the result.
  3. Use the “Run Now” functionality to test the regular expression.

Examples
Below are the results when using each of the Patterns with this example URL in the “Input text” field:

https://DomainName.com/sites/SiteName/SubsiteName/ListName.aspx

PatternResult
(^https:\/\/[\w\d].[\w\d]*)https://DomainName.com
(^https:\/\/[\w\d].[\w\d]\/[\w\d]*)https://DomainName.com/sites
(^https:\/\/[\w\d].[\w\d]\/sites\/[\w\d]*)https://DomainName.com/sites/SiteName
(^https:\/\/[\w\d].[\w\d]\/[\w\d]\/SiteName\/[\w\d])https://DomainName.com/sites/SiteName/SubsiteName

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: