I'm trying to separate the last character which should be a letter [A-F] if the the string has 3 numbers in a row somewhere previous.
For example, 103C would return 2 separate fields 103 and C A103B would return 2 separate fields A103 and B. FX103D would return 2 separate fields FX103 and D. LOCATION2 would just return LOCATION2 and the 2nd field would be blank.
I've done something similar before with regexp_like, but I'm new to regex in general so I'm not sure how'd I'd accomplish this.
For a similar application, I've done regexp_like(c_lab.loc_code_from,'^\d{5}[[:alpha:]]') which looks at the first 5 characters, if they're numbers then the condition is satisfied and I split it up accordingly as shown below.
CASE
WHEN regexp_like(c_lab.loc_code_from,'^\d{5}[[:alpha:]]')
THEN substr(c_lab.loc_code_from, 1, 5)
ELSE c_lab.loc_code_from
END as "From Location",
CASE
WHEN regexp_like(c_lab.loc_code_from,'^\d{5}[[:alpha:]]')
THEN substr(c_lab.loc_code_from,6,1)
ELSE 'A'
END as "From Level ID"
YOu can use the below which is as per your requirement . The Db fiddle here