Hey Guys i wanna manipulate my string (path) and write it back to column.
The Problem is that i dont really get why my expression is not working.
This is my input string C:\Users\dgd2\Desktop\zip-Dateien\Quelldateien\vjkre1906.20190702.134206500.xml
and i need this as output vjkre1906.20190702.134206500
How can i solve it ?
Thanks so far.
Why not use a String Mainpulation node with:
substr($Location$, 0, lastIndexOfChar($Location$, ‘.’ ) )
replace($Location$, “.xml” , “” )
regexReplace(substr($column1$, (lastIndexOfChar($column1$, '\\') + 1)), "\\.xml" , "")
as the “regexReplace” funciton indicates, it replaces content. What is also worth to know is that, if it does not match, it returns the whole string.
In your case the RegEx should look like so:
regexReplace(replace($Location$, ".xml", ""), "^.* Quelldateien\W", "")
Edit: Adjusted to filter for the suffix. Though, i just recognized that by converting the string into URL and using, I think it was the Extract URI Info node, you get the file name too. That node can not be used if you have dots in the file name!
This will replace everything you do NOT want to be present afterwards. Please note that I deliberately included \W to make the function interoperable … working on Windows and Linux.
As a side note, you may use the String Replacer node. It works much better when lopping over various columns i.e. when using the Column List Loop Start.
I see you have already got several solutions. Here is mine:
regexReplace($Location$, ".*\\\\(.*)\\.xml", "$1")
Nice to see quite a few regex experts…
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.