Extract Regular Expression


Badge +4

Whats the expression that i can use to extract url without filename ?

https://xyz/sites/test/file.xlsb


7 replies

Userlevel 5
Badge +13

Try using this expression in the Pattern field:  /[^/]*$

The steps to configure the Regular Expression action are in my blog post: Remove a Forward Slash at the End of a URL String in Nintex Workflow

Badge +4

Hi Eric, 

Thank you for reply. /[^/]*$ gets filename and removes url. I need url without filename.

Userlevel 5
Badge +13

Hi Rose,

Which version of Nintex Workflow are you using? I ran this in both Nintex Workflow 2013 and Nintex Workflow for O365, with both returning just the URL from your expression. If you're using the Nintex Workflow 2013, try using the Run Now option to see what you get. Below is how I configured the Regular Expression action.

Regular Expression - Remove file to get URL

Badge +4

HI Eric, 

With Replace i got it. What would be the expression if i want to use extract option to store in collection variable ?

Userlevel 5
Badge +13

Try this pattern:  .*(?=/)

Badge +4

Thank You Eric. By using this i got url without filename but with ; at end. 

https://xyz/sites/test/file.xlsb  - Result: https://xyz/sites/test;

Badge +4

Thank You Eric. By using this i got url without filename but with ; at end. 

https://xyz/sites/test/file.xlsb  - Result: https://xyz/sites/test;

I have used  .*(?=/)/ and it worked. Thank You once again.

Reply