UiPath 是否允许正则表达式使用 \n?
Does UiPath allow Regex use of \n?
我有一个非常简单的序列:
使用 OCR 读取 pdf,输出为 ReadPDF 字符串变量
A 匹配 activity 与正则表达式公式“(?<=Order Number\n\n)\d{5}”,输出 |Enumerable 变量 WorkOrder
和 Assign activity 将结果放入变量 idOrder = WorkOrder(0).ToString
正则表达式在测试环境中工作:
https://regex101.com/r/dmYhAY/8
我收到一个错误:分配:对象引用未设置到对象的实例。
我以前曾多次成功使用匹配 activity,但我不确定为什么这不起作用。
我在 Regex 中使用的任何内容(例如 \n)在 UiPath 对 Regex 的使用中是不允许的吗?
这是the UiPath Workflow
的截图
最终起作用的正则表达式是:(?<=Order Number[\n\r]+)\d{5} 给我的原因是... "Regarding the newlines it can appear (in) different forms depending on the environment, dealing with Microsoft apps will often be \r\n or so."
不一致的原因是UiPath使用的是.Net Regex,所以我现在使用的是:
http://regexstorm.net/tester
我所有的 Regex 测试都取得了巨大成功,并且在将其转移到 UiPath 时没有遇到更多问题。
我有一个非常简单的序列:
使用 OCR 读取 pdf,输出为 ReadPDF 字符串变量
A 匹配 activity 与正则表达式公式“(?<=Order Number\n\n)\d{5}”,输出 |Enumerable 变量 WorkOrder
和 Assign activity 将结果放入变量 idOrder = WorkOrder(0).ToString
正则表达式在测试环境中工作: https://regex101.com/r/dmYhAY/8
我收到一个错误:分配:对象引用未设置到对象的实例。
我以前曾多次成功使用匹配 activity,但我不确定为什么这不起作用。 我在 Regex 中使用的任何内容(例如 \n)在 UiPath 对 Regex 的使用中是不允许的吗?
这是the UiPath Workflow
的截图最终起作用的正则表达式是:(?<=Order Number[\n\r]+)\d{5} 给我的原因是... "Regarding the newlines it can appear (in) different forms depending on the environment, dealing with Microsoft apps will often be \r\n or so."
不一致的原因是UiPath使用的是.Net Regex,所以我现在使用的是: http://regexstorm.net/tester 我所有的 Regex 测试都取得了巨大成功,并且在将其转移到 UiPath 时没有遇到更多问题。