LarsKohsel
Novice

Path manipulation - How to?

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.

0 Kudos
3 Replies
SimonMuntz
Nintex How-To Center Expert
Nintex How-To Center Expert

Re: Path manipulation - How to?

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

0 Kudos
LarsKohsel
Novice

Re: Path manipulation - How to?

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?

0 Kudos
SimonMuntz
Nintex How-To Center Expert
Nintex How-To Center Expert

Re: Path manipulation - How to?

Hi,

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

0 Kudos