Hello all,
I have this string "US CRE Head (Joe Shmoe)". I am trying to create a column that includes only everything before the "Head". What is the best method? Thanks.
You can use the Regex Tool (in the parse Toolset)
In the config:
1) Choose the field to Parse
2) type in the regular expression: (.*)Head.*
3) Set the output method to Parse
That will create a new field with whatever is before head.
I highly reccomend learning Regex in you're unfamilar - it is the secret to the universe.
Worked like a charm, thanks Bob! I had a feeling regex was the answer but couldn't find a beginner resource yet. If you know of one feel free to share. Have a great day.
I agree with the RegEx solution. Just to show an alternative if you're not ready to dive into RegEx, you could use a Formula Tool with this:
TRIM(Left([Field], FindString([Field], "Head")))
Just replace [Field] with the name of the field containing the string. The TRIM removes any whitespace, the Left takes the characters to the left of the location FindString provides.
@Bob_Blackey,
What is the meaning of life? 42. Besides that, I agree RegEx!
I might caution @Afammy on the parse logic.
(.*)Head.*
If "Head" exists multiple times in the field, this will parse out based upon the last (rightmost) occurence of the term "Head".
Other than that, we're in total agreement.
Cheers,
Mark
Another great solution- thanks!
Y'all are amazing!!! I have been struggling to remove information and this formula actually did the trick for me. I love this community and how everyone is so helpful!
THANK YOU for saving me several hours trying to figure out the syntax!
--Kim XX