Snowflake正则表达式需求:提取至第四个"\n \n"前的文本
提取第四个"\n \n"之前内容的Snowflake表达式
核心SQL表达式
SELECT SUBSTRING( input_text, 1, POSITION('\n \n' IN input_text, 1, 4) - 1 ) AS extracted_content FROM ( -- 替换为你的实际表和字段,以下为示例文本演示 SELECT 'Hello Jeffrey,\n \nWe have not heard from you yet. I hope all is well with you.\n \nChecking in to gather your <strong>Goosehead approved office location address</strong>, so we can add you to our database here at ERGOS. Once added here, we can schedule your laptop setup.\n \n<em>Goosehead <strong>requires all agents</strong> to be onboarded by ERGOS so that we can provide IT support as well as get your laptop in our database.</em> \n \nDo you have a laptop ready for setup?' AS input_text ) AS temp;
表达式说明
POSITION('\n \n' IN input_text, 1, 4):定位字符串中第4次出现的\n \n的起始位置SUBSTRING(..., 1, ... -1):从字符串开头截取到第4个\n \n的前一位,得到目标内容
原文翻译
你好杰弗里,
我们还没收到你的消息,希望你一切顺利。
特此跟进,收集你的Goosehead认证办公地址,好让我们把你加入ERGOS的数据库。完成添加后,我们就能安排你的笔记本电脑配置事宜。
Goosehead 要求所有代理人必须通过ERGOS完成入职,这样我们才能提供IT支持并将你的笔记本电脑纳入数据库管理。
内容的提问来源于stack exchange,提问作者Nur
相关产品推荐
相关产品推荐

