Good day.
The task is as follows: there is a line like 'Channel aps-61.ds0Grp-1.1.5.3.1: 0.0'. It is necessary in postgres to convert it (probably using regexp) to the form: aps-61-VC4-1-TU-1.5.3. Those. from 1.1.5.3.1: 0.0 the first number is taken and is written after VC4-, and the next three numbers 1.5.3 are written as TU-1.5.3. Subsequent numbers recline.
I tried to solve this problem like this:
SELECT regexp_matches('Channel aps-61.ds0Grp-1.1.5.3.1:0.0', 'aps-[0-9]{2}') But the thought has not advanced further; regular expressions are given with difficulty. You can, of course, probably connect the python module to postgres and create a function, but you can get by with less blood. If you have ideas, I will be grateful.
regexp_replace(x,'.*?(aps-\d+).*?-(\d+)\.(\d+\.\d+\.\d+).*$','\1-VC4-\2-TU-\3')regex101.com/r/tAClFJ/1 - Mike