如何使用 ruby/watir 验证网页文本,同时排除随机变量
我有此文本,只需验证每行中的粗体字:
受保直接账单/ 16.67%: $xxx.xx 向下,包括保单费和财务责任费,以及 5分期付款 $xxx.xx(不包括 $x.xx 分期付款费用)
受保直接账单/25%:$xxx.xx 首付,包括政策费用和财务责任费,以及 5 期付款 $xxx.xx(不包括 $x.xx 分期付款费用)
电子资金转账:$xxx.xx 首付,包括保单费和财务责任费,以及 5 期付款 $xxx .xx (不包括 $x.xx 分期付款费用)
我假设我需要使用:
foo = REGEX
@browser.text.include?(foo)
我不知道如何获取它可以查看除货币金额以外的所有内容。 [^$\d+.\d+] 排除所有货币,但包括 5 和 16.67
谢谢
I have this text and need to verify the bolded words only in each line:
Insured Direct Bill / 16.67%: $xxx.xx down, includes the Policy Fee and Financial Responsibility Fee, and 5 installments of $xxx.xx (does not include $x.xx installment fee)
Insured Direct Bill / 25%: $xxx.xx down, includes the Policy Fee and Financial Responsibility Fee, and 5 installments of $xxx.xx (does not include $x.xx installment fee)
Electronic Funds Transfer: $xxx.xx down, includes the Policy Fee and Financial Responsibility Fee, and 5 installments of $xxx.xx (does not include $x.xx installment fee)
I'm assuming I'll need to use:
foo = REGEX
@browser.text.include?(foo)
I'm stuck at how to get it to see everything other than the currency amounts. [^$\d+.\d+] excludes all the currency but includs the 5 and 16.67
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Marick 的书 Everyday Scripting with Ruby 中有一些正则表达式课程. 如果您需要不时使用正则表达式,我建议他们增强您的能力。
There are some regex lessons in Marick's book Everyday Scripting with Ruby. I recommend them to strengthen your capability if you need to use regex from time to time.