正则表达式菜鸟 - 如何匹配像"piece square-78 bn"这样的表达式,其中数字 78 可以是任何正值?



我想捕获一个表达式"piece square- 78bn "其中数字78可以是任意正值

我正在使用Stylus来样式chess.com客户端。

下面的代码不能工作:

div [style*="bp.png"],
div [class^="piece square-.[0-9].[0-9] bp"] {
background-image: url("https://images.chesscomfiles.com/chess-themes/pieces/club/150/bp.png")!important;
}

我认为

类^ ="平方。[0 - 9]。[0 - 9]英国石油(bp)

意味着捕捉任何以"piece square"开头的类。后面是"任意长度的正数值"。并以&quot结尾;bp" .

不工作。

有人知道吗?

干杯弗兰基金

使用模式piece square-[0-9]+ bn。更新代码:

div [class^="piece square-[0-9]+ bn"] {
background-image: url("https://images.chesscomfiles.com/chess-themes/pieces/club/150/bp.png")!important;
}

最新更新