Skip to main content

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.)(?:(p-A-Z0-9+&@#/%=~_|$?!:,.]*)|:-A-Z0-9+&@#/%=~_|$?!:,.])*(?:(]-A-Z0-9+&@#/%=~_|$?!:,.]*)|:A-Z0-9+&@#/%=~_|$])/igm

 

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!



 



 


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



 


Reply