Skip to main content
Nintex Community Menu Bar

Path manipulation - How to?

  • November 23, 2022
  • 3 replies
  • 56 views

Forum|alt.badge.img+1

Hello

I call the SharePoint REST API to get a relative path to a library/subfolder

The return value is something like '/sites/site1/library1/subfolder1/subfolder2' however I need to remove the first two levels in order to construct another path. The path I need for the example is '/library1/subfolder1/subfolder2'

I have tried using regular expressions with named groups, but I did not succeed in that. Then I tried to split the path by the character '/', which I managed to do. However, I have no success in iterating 3 times removing the first element of the collection on each iteration.

 

Can someone please explain how to do this or another way to remove the first levels in the path.

3 replies

SimonMuntz
Nintex Employee
Forum|alt.badge.img+23
  • Nintex Employee
  • November 24, 2022

Hi,

Use the replace operation in a regular expression.
The pattern is:
^/w*/w*/

This will output:
library1/subfolder1/subfolder2
Replace it with /
To give you
/library1/subfolder1/subfolder2


Forum|alt.badge.img+1
  • Author
  • Rookie
  • November 24, 2022

Thank you for the suggestion. The RegEx actually works if I try it on regex101.com or if I run it with "Run now" option in Nintex Designer, but when I run the workflow the RegEx action outputs excactly the same string as the input. Any suggestions, how to fix this?


SimonMuntz
Nintex Employee
Forum|alt.badge.img+23
  • Nintex Employee
  • November 24, 2022

Hi,

I tested this in a published workflow.
And this was my result.
/library1/subfolder1/subfolder2