regex - 多行文本的Vbscript正则表达式?
问题描述
"value:=This customer has one or more active tax exemptions available\.
\n
\n
Do you want to apply a tax exemption to this transaction\?"
我尝试了正则表达式,"Value:=This.*"
但它没有识别整个文本。请告诉我如何通过仅验证整个文本中的第一个单词来使用 VbScript 正则表达式识别整个文本。谢谢。
解决方案
例如:
Dim s : s = "value:=This customer has one or more active tax exemptions available." & vbCrLf & vbCrLf & "Do you want to apply a tax exemption to this transaction?"
With New RegExp
.Pattern = "^value:=This(.|\n|\r)*"
With .Execute(s)
WScript.Echo .Item(0).Value
End With
End With
....Pattern
以 (^) ' value:=This ' 开头,后跟任何字符 (.)、换行符(又名换行符)(\n) 或回车符 (\r) 重复零次或多次 (* )。
输出:
value:=This customer has one or more active tax exemptions available.
Do you want to apply a tax exemption to this transaction?
希望这可以帮助。
推荐阅读
- typescript - 如何在 Angular 8 中为延迟加载模块使用通用指令
- java - Spring jpa 无法删除实体,因为表有 fk
- python - 如何在不更改条目的其他变量的情况下更改 tkinter 条目的状态?
- android - 建立连接后如何获取所有firebase推送通知
- android - 如何防止 kivy 应用程序在执行某些后端功能时变得无响应
- python - 我如何将数据从 python django 输出到 html
- c# - 在文本框中显示 SQL 查询
- c++ - 为什么要调用复制构造函数?
- javascript - 将用户批量添加到语音频道
- java - zuul限速和hystrix隔离策略有什么关系?