0

我需要通过分隔符将我的文本拆分为表格'<=''=>'例如

select regexp_split_to_table('kik plz <= p1 => and <= p2 => too. A say <=p1 =>','regexp');

结果必须是:

table:
--------------
1 | 'kik plz '
2 | '<= p1 =>'
3 | ' and '
4 | <= p2 =>
5 | ' too. A say '
6 | '<=p1 =>'

我认为答案在于位置模式,但我的技能还不够。

select regexp_split_to_table('kik plz <= p1 => and <= p2 => too. A say <=p1 =>', '((\s)(?=<=))|((\s)(?!=>))') 

这会返回错误的结果。

4

1 回答 1

1
select regexp_split_to_table(
    replace(
        replace('kik plz<= p1 =>and<= p2 =>too. A say <=p1 =>',  '<=',  E'\001<=')
    , '=>', E'=>\001')
, E'\001');
于 2015-12-15T18:13:13.403 回答