确切:精装书: $79.99
这是总要素。我只需要获得价值$79.99
。
商店/确切:精装书:79.99美元/ i storeEval
/storedVars['i'].search($79.99)/结果
我已经尝试了上面的方法,但是它不起作用。
最好的做法是存储完整的元素,然后使用正则表达式将其分解。
因此,在这里反映您的示例:
<tr>
<td>store</td>
<td>exact:Hardcover: $79.99</td>
<td>full</td>
</tr>
<tr>
<td>storeEval</td>
<td>storedVars['full'].match(/[^: ]+$/)</td>
<td>price</td>
</tr>
<tr>
<td>echo</td>
<td>${price}</td>
<td></td>
</tr>
给出以下输出
[info] Playing test case Untitled
[info] Executing: |store | exact:Hardcover: $79.99 | full |
[info] Executing: |storeEval | storedVars['full'].match(/[^: ]+$/) | price |
[info] script is: storedVars['full'].match(/[^: ]+$/)
[info] Executing: |echo | ${price} | |
[info] echo: $79.99
[info] Test case passed
有关正则表达式如何分解的信息,请参见此处
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句