AntiPattern

Regex Token-Splitting Fragility

regex-based-token-splitting-fragility

there is a varying number of parts because of the UP/DOWN possibility — I tried using a combination of split_part(). Tension: I couldn'd find a solution that properly works. Outcome: simply split the string and keep all but the last two parts. | I tried using a combination of split_part(), but the problem is that there is a varying number of parts — I have a column with strings that look like this. Tension: I couldn'd find a solution that properly works. Outcome: keep the first 2 OR 3 parts of the string. | That can be solved using a regular expression like: — select substring(ID, '(^[A-Z]{2}.[A-Z]{1}(.UP|.DOWN))') from table1;. Outcome: select substring(ID, '(^[A-Z]{2}.[A-Z]{1}(.UP|.DOWN))') from table1;.