简体   繁体   English

为此HTML设计正则表达式

[英]Design regex expression for this html

In this html line: 在此html行中:

<b>Cash Out: </b> 2.46x </p> <p> <b>Played: </b>Sat Ene 12 2015 00:20:13

How I could match the 2.46x value? 如何匹配2.46x值?

This is the expression that I've tried to design: 这是我尝试设计的表达式:

"(cash.+out.+\s+)([\d\.]+[^\s])"

PS: I know that RegEx motor was not designed to parse Html, but anyways it can be done so please avoid that kind of comments since also I'm using a limited language for this task, VisualBasicScript . PS:我知道RegEx motor并非旨在解析Html,但是无论如何都可以这样做,因此请避免这种注释,因为我也为此任务使用了一种受限语言VisualBasicScript

Your regex matches <b>Cash Out: </b> 2.46x </p> <p> <b>Played: </b>Sat Ene 12 2015 , right? 您的正则表达式匹配<b>Cash Out: </b> 2.46x </p> <p> <b>Played: </b>Sat Ene 12 2015 ,对吗? I'd suggest narrowing it down to after the closing tag + space. 我建议将其缩小到结束标记+空格之后。

Try this: cash.+out.+\\s+<\\/\\w+>\\s+([\\d\\.]+x) 试试这个: cash.+out.+\\s+<\\/\\w+>\\s+([\\d\\.]+x)

The value you are looking for will be in the first submatch. 您要查找的值将在第一个子匹配项中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM