如何在公式中加入\n提取邮件字符串中的period值
解决Power Automate中提取带换行符的Period数值问题
针对你遇到的情况,提供两种可行的公式修改方案:
方案一:直接匹配带换行的分隔符
由于原始文本中period后带有换行符\n,可以在分隔符中明确包含换行(用decodeUriComponent('%0A')表示URL编码的换行符),精准定位数值开头:
trim(first(split(last(split(body('Html_to_text'), 'period' & decodeUriComponent('%0A') & '= ')), 'DATA')))
这个公式会直接拆分出202204012,无需额外处理。
方案二:先提取包含数值的片段,再清理多余字符
如果不想处理换行符,也可以先提取出= 202204012这个片段,再通过替换或拆分去掉=和空格:
替换法
trim(replace(first(split(last(split(body('Html_to_text'), 'period')), 'DATA')), '=', ''))
拆分法
trim(last(split(first(split(last(split(body('Html_to_text'), 'period')), 'DATA')), '= ')))
两种方法都会把= 202204012转换为纯数值202204012。
内容的提问来源于stack exchange,提问作者Binary Struggle
相关产品推荐
相关产品推荐

