I have a column with strings of varying length. All strings have 1 semicolon separating the first and last part of the string.
some strings with no 'periods':
_______________;______
some strings with 1 period
______.______;_______
some strings with 2 periods
___._______._____;_________
I want to create a new column and populate it with the string of interest with the following conditions:
- IF a string contains exactly 2 periods, I want to remove everything from the second period up to the semicolon
- example: "before1st.after1st.after2nd;afterSemiColon" would return "before1st.after1st;afterSemiColon"
- ELSE, i just want to leave the string alone (no changes)
I'm having trouble with this since the length of characters between each period can vary
any help on the best way to achieve this would be greatly appreciated! thank you!