Hi -
I have a string data field with trailing shareclass identifiers that I want to remove.
Example: ABC Fund CL A, where "CL A" is the text I am trying to remove.
I am trying to create a simple RegEx replace tool that finds that "CL" and replaces "CL" and anything that follows with nothing, but was struggling with the syntax to accomplish this. Can anyone help?
Thanks in advance.
Solved! Go to Solution.
Regex_Replace([Field1],"CL .*?$","")
Should work as well
It will match the last 'CL ' in a string and then replace it and anything else with "".
Far be it from me to try to interfere with @jdunkerley79 's quest for solution glory. If you have a fund name like this:
Clough Funds Trust: Clough Global Long/Short Fund; Class I Shares
His expression is going to miss out on the desired results. I wrote the following expression:
REGEX_Replace([Fund], "(.*)\WCL.*", '$1')
It returns:
Clough Funds Trust: Clough Global Long/Short Fund;
You can modify the expression to remove the semi-colon if it is really present or trimright(fund,";") will work easily enough.
Cheers,
Mark
P.S. It is perfectly acceptable to mark multiple solutions on your post. I'm just giving James a run for his money.
Thanks for the help everyone!