Hi,
I've searched various posts but couldn't find an answer that worked. I have a string of data, "1/FundName-Class", and I want to extract everything left of the / using regex_replace. The numbers go from 1-47000 so a LEFT function won't work. Any help is appreciated.
Solved! Go to Solution.
Hey @cmohyi!
When you want to use a symbol in a regex statement, put a \ before it. Below I created two new fields, one that keeps everything before your slash and one that keeps everything after the slash. Remember, this assumes you only have one slash in your Field1.
Here's 2 alternative solutions (I do see that @Kenda has answered while I was playing with your post):
REGEX_Replace([Field1], "(.*)\/.*", '$1')
left([Field1],FindString([Field1], "/"))
The first function will take anything left of the "last" / and provide you with that value.
The second function will take the leftmost characters that it finds before the first /.
Cheers,
Mark
@barnesk @marqueecrew Thank you both!
Hello @Kenda .What if there are more than 2 slashes found? What expression should be used to delimit them to more than 2 columns. Thank you
Hi - this is a fairly old thread. Post some examples of your regex problem in a new thread and I'm sure someone can help you...