Hi @mmngeoh , one of the problems here is that without real-world examples of your data, it is difficult to know what exact solution to give to your problem especially as regex is quite a precise tool. This is why in part @gonhaddock was asking “Besides that, what about upper or lower case occurrences? Is it always a literal match “Apple”?”.
You originally posed the question
“Could anyone help to provide a regex formula to retain “Apple” and remove any other characters for column header ?”
and that had me wondering whether you really wanted regex to keep “Apple” (which is what @gonhaddock supplied) or are you really asking for some other part of the string to be removed (and you actually don’t care if it’s an Apple or an Orange). So your question has now subtly changed and you really want to remove the prefix (month), which makes things a little clearer.
But this leads to a further question, because in your very first post you gave the example:
JunApple, JulyApple, AugApple, DecemberApple, etc…
But this means you sometimes have 3 letter months (Jun, Aug) but interchange these with whole names (July, December). Is that really the case? Without being specific in requirements, it is difficult to be specific in a solution. In your more recent post you do imply it is a three letter-prefix, but I will try to be slightly flexible
Anyway, I will assume that your requirement is that you have month names as prefixs to some value (for example “Apple”). Your month names are either 3 letters or whole names, and that they use Title case, e.g. Jan, Feb, November, December
In this situation, the following regex applied to a Column Rename (regex) node will return you everything that comes after the month:
JunApple, JulyApple, AugApple, DecemberApple, AprOrange etc…
(Although, lol, I hope you don’t have a column named Apricot, as you will just get back icot )
Note that it was important that I listed the whole names first, and the 3-letter variants later in the regex. Otherwise it will match a 3-letter and leave the rest of the month in the returned value.
MarchApple would be returned as
Also, if more than one column becomes “Apple” as a result, they will automatically be given a numeric # suffix: