1

Topic: The regular expressions, transfer of a line after the fourth comma

Good afternoon;
Help  with the task.
There is a line:
' 4607280,4808678,5228897,5286161,5488544,5526142,5526143,5526144,5526145,5526146,5643496,5643497,5657008,5657009,5659850,5677920,5677924,5677926,5677932 '
It is necessary, after every fourth comma to deliver transfer of a line.
That as a result it turned out:
' 4607280,4808678,5228897,5286161;
5488544,5526142,5526143,5526144;
5526145,5526146,5643496,5643497;
5657008,5657009,5659850,5677920;
5677924,5677926,5677932 '

Who tried   so:

WITH q AS
(SELECT ' 4607280,4808678,5228897,5286161,5488544,5526142,5526143,5526144,5526145,5526146,5643496,5643497,5657008,5657009,5659850,5677920,5677924,5677926,5677932 ' AS x1
FROM dual)
SELECT regexp_replace (x1, ' (. *), (. *), (. *), (. *), ', '\1, \2, \3, \4, ' || chr (13) || chr (10)) AS x1 FROM q

But the last were processed only:
4607280,4808678,5228897,5286161,5488544,5526142,5526143,5526144,5526145,5526146,5643496,5643497,5657008,5657009, 5659850, 5677920, 5677924, 5677926;
5677932

2

Re: The regular expressions, transfer of a line after the fourth comma

;
Many thanks!

3

Re: The regular expressions, transfer of a line after the fourth comma

regexp_replace (x1, ' (([^,] +,) {4}) ', '\1 ' || chr (10))