Replacing "\" in a file path string

Hi,

I’m trying to replace the file path input with automatically locating the file where the revit file exists using the document.current node. I can replace the file extension .rvt and create another folder. But what i want to achieve is to replace the total file name.rvt . To do that I have the split the string at each “” . But that doens’t work in a code block.
Eg: C:\Users\Username\Desktop\Filename.rvt
currently what i did C:\Users\Username\Desktop\Filenameedit\Export {using the string replace and concatenate}
What i want to achieve
C:\Users\Username\Desktop\Export

Thanks!

Try this pattern \w*.rvt with clockwork RegularExpression.Replace node

You can just use some built-in nodes: