Regex between first and second "-"

Hey,
Good point! Now I think I have found a one-node-solution, but it is not very pretty. You can use this expression in the String Manipulation node to handle all 4 cases:

regexReplace($Data$, "^[^-]+-([^-]+).*", "$1") == $Data$ ? "" : regexReplace($Data$, "^[^-]+-([^-]+).*", "$1")

Using the Java ternary operator was inspired by this post. But of course it is a bit ugly that we need the regexReplace twice.
Alexander

5 Likes