Skip to main content
Nintex Community Menu Bar
Solved

Regular Expression to extract URL from text string

  • November 9, 2022
  • 2 replies
  • 1189 views

bobFermi
Forum|alt.badge.img+2

Hello All,

 

I need to extract URL(s) from a text string using the regex function.  A sample string may be something like: "This is a test https:||yahoo.com this is still a test"  (I had to replace the // with || to be able to post a URL)

 

I found a regex expression online that works great when I test it with a regex tester online, however the Nintex regex action returns nothing.  Why would this regex expression work on a regex tester but not for nintex?

 

 

/(?:(?:https?|ftp|file)://|www.|ftp.)(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[A-Z0-9+&@#/%=~_|$])/igm

 

Best answer by MegaJerk

It might not be working for you because of the enclosing regex brackets and tokens at the end: 

/.../igm

 

If I format it without those opening and closing brackets / tokens:

(?:(?:https?|ftp|file)://|www.|ftp.)(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[A-Z0-9+&@#/%=~_|$])

 

And instead configure the Regex Workflow Action to ignore case:

 

Then I get a working match extraction:

 

Let me know if this solves the issue for you!

 

PS: Remember that you'll need to assign a Collection type Workflow Variable to the output of your Regex Extraction! It will output ALL matches to their own index in the Collection!

 

 

View original
Translate

MegaJerk
Forum|alt.badge.img+14
  • Scholar
  • November 10, 2022

It might not be working for you because of the enclosing regex brackets and tokens at the end: 

/.../igm

 

If I format it without those opening and closing brackets / tokens:

(?:(?:https?|ftp|file)://|www.|ftp.)(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[-A-Z0-9+&@#/%=~_|$?!:,.])*(?:([-A-Z0-9+&@#/%=~_|$?!:,.]*)|[A-Z0-9+&@#/%=~_|$])

 

And instead configure the Regex Workflow Action to ignore case:

 

Then I get a working match extraction:

 

Let me know if this solves the issue for you!

 

PS: Remember that you'll need to assign a Collection type Workflow Variable to the output of your Regex Extraction! It will output ALL matches to their own index in the Collection!

 

 

Translate

  • November 12, 2022

Using RegexBuddy:

To Get URL only:

.*(?=/)/

 

To Get Filename only:

(?<=/)[^/?#]+(?=[^/]*$)

 

Test String:

This is a URL with a filename https://yahoo.com/gtip/foo.mmmhttps://yahoo.com/gtip/foo.pdf

 

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings