I am using the following expression to remove some stuff I do not need in column Serial_number
I want to remove (R) (L) (X) RIGHT LEFT
(removeChars(removeChars(removeChars(removeChars(($serial_number$, "(R)"),"(L)"),"(X)"),"RIGHT"),"LEFT"), " LEFT")
Although, I see it actually removes all Rs or Ls or Xs. etc.
How can I make it work? is there something like in dollar in excel "$(R)$"... just guessing..
I didn't try it, but I guess that escaping the brackets with backslash characters would work - like this: \(R\)
Brackets and a few other characters have special functions in regular expressions and/or Java, and therefore need to be escaped when they are to be interpreted litereally.
You should use replace with "" as its third parameter. So your expression should be something like:
replace(replace(replace(replace(replace($serial_number$, "(R)", ""),"(L)", ""),"(X)", ""),"RIGHT", ""),"LEFT", "")
Yes it did work! thank you!
If you have serial numbers (see examples bellow)
and you want to delete only the R that is always at the end of the serial number (example 2), but definitely not the R that is in the middle of the serial number (example 1). How you can do that properly in string manipulation?
If you are familiar with Regexes, it is quite easy. I think there is a regexReplace function/manipulator in the String Manipulation node.
And if you're unfamiliar with Regex: specific Java Regex questions are usually answered within minutes on StackOverflow... :-)