Reputation: 11
I need to split my text to table by delimiters '<='
and '=>'
, for example
select regexp_split_to_table('kik plz <= p1 => and <= p2 => too. A say <=p1 =>','regexp');
The result must be:
table:
--------------
1 | 'kik plz '
2 | '<= p1 =>'
3 | ' and '
4 | <= p2 =>
5 | ' too. A say '
6 | '<=p1 =>'
I think the answer is in positional patterns, but my skills are not enough.
select regexp_split_to_table('kik plz <= p1 => and <= p2 => too. A say <=p1 =>', '((\s)(?=<=))|((\s)(?!=>))')
This returns the wrong result.
Upvotes: 0
Views: 1769
Reputation: 11
select regexp_split_to_table(
replace(
replace('kik plz<= p1 =>and<= p2 =>too. A say <=p1 =>', '<=', E'\001<=')
, '=>', E'=>\001')
, E'\001');
Upvotes: 1