任何人都可以帮助我找到以下代码行中包含的错误的核心?红宝石 - 包括?相关问题
main_frame.html.include? =~ /Your credit card does not have any statements|No activity is found in your credit card/i
任何人都可以帮助我找到以下代码行中包含的错误的核心?红宝石 - 包括?相关问题
main_frame.html.include? =~ /Your credit card does not have any statements|No activity is found in your credit card/i
要调用两种方法include?
和=~
。前者需要一个参数,所以它不能成为=~
的参数。
那么,如果我更换包括?与匹配它会工作? – guitarfreak
只需阅读这些方法的文档,你就会开悟;)。 – medik
@guitarfreak'=〜'_is_方法调用。删除'include?'应该可以工作,即'main_frame.html =〜/.../ i'。根据上下文,你可能也可以使用'match'或'match?'_insert of_(除了)'=〜'。 – Stefan
你可能想使用下列之一:
!!(main_frame.html =~ /Your credit card does not have any statements|No activity is found in your credit card/i)
或
!!(/Your credit card does not have any statements|No activity is found in your credit card/i.match main_frame.html)
或(使用include?
但没有正则表达式)
非常有用的答案,thx – guitarfreak
你得到一个错误?是“任何”故意后的分界线? – Stefan
我在显示其中一个表达式的页面上得到一个零,结果应该是一个数字。这条线的打破与此处的格式有关Stackoverflow – guitarfreak
什么是(main_frame.html'的结果)以及表达式应该返回什么? – Stefan