我正在尝试替换下面的文字以填充问号
SELECT REGEXP_REPLACE('?????/ ?????? John
??? ????? ??????? ?? ????? Pediatric Clinic ?? ??? 10 MAY 15 ?????? 01:15 PM
?????? ?????? ??? 15 ????? ?? ?????? ??????
Thanks.',
'^[?/ ]+([a-z0-9 ]+)[?\s]+([a-z0-9 ]+)[?\s]+([0-9a-z ]+)[?\s]+([0-9a-z: ]+).+$','Mr/Ms \1, We would like to remind you about your appointment in \2 on \3 at \4. Please come 15 minutes before your appointment time. Thanks ',1,1, 'm') msg
FROM DUAL
但我总是得到相同的纠正字符串,即使匹配工作正常:
SELECT 'Ok' Result FROM DUAL WHERE REGEXP_LIKE('?????/ ?????? John
??? ????? ??????? ?? ????? Pediatric Clinic ?? ??? 10 MAY 15 ?????? 01:15 PM
?????? ?????? ??? 15 ????? ?? ?????? ??????
Thanks.',
'^[?/ ]+([a-z0-9 ]+)[?\s]+([a-z0-9 ]+)[?\s]+([0-9a-z ]+)[?\s]+([0-9a-z: ]+).+$', 'm')
答案 0 :(得分:0)
这样的事情怎么样:
SELECT REGEXP_REPLACE('?????/ ?????? John
??? ????? ??????? ?? ????? Pediatric Clinic ?? ??? 10 MAY 15 ?????? 01:15 PM
?????? ?????? ??? 15 ????? ?? ?????? ??????
Thanks.',
'[?/ ]*([^?[:cntrl:] ]*)[[:cntrl:]?/ ]*([^?]*) [?/ ]*([^?]*) [?/ ]*([^?[:cntrl:]]*)[[:cntrl:]?/ ]*([^? ]*)[?/ ]*([^? ]*)(.*)'
,'Mr/Ms \1, We would like to remind you about your appointment in \2 on \3 at \4. Please come 15 minutes before your appointment time. Thanks',1,1, 'm') msg
FROM DUAL;
你的正则表达式与你的第二行匹配(“??? ?????????????????????????????????????????????????? ?? 01:15 PM“)并用替换表达式替换你的第二行。