I have I have a column address
with the string like this:
Tow 10 Floor 223, Ward AA BB, District CC DD, City E F
and
Tow 110 Floor 23, Ward BB AA, District DD CC, City F E
...
(more than 10000 lines)
I want to split this string into separate columns, remove the characters after the 2nd comma and insert column with split value into my table.
Look like this:
Tow | Floor | Ward |
---|---|---|
10 | 223 | AA BB |
110 | 23 | BB AA |
2
Answers
Use
split_part()
, which doesn’t support regex so you’ll have to nuke the commas:Using
regexp_match
:See fiddle.