select t.* from (
SELECT
'XY1234Z好的13' as 原始字段,
NULLIF(regexp_replace('XY1234Z好的13', '\D','','g'), '')::numeric AS 提取数字
union all
'25我是数据' as 原始字段,
NULLIF(regexp_replace('25我是数据', '\D','','g'), '')::numeric AS 提取数字) t
order by t.提取数字
截取出来,在按截取字段排序啊