正则表达式没有按要求工作
代码示例:
widgetCSS = "#widgetpuffimg{width:100%;position:relative;display:block;background:url(/images/small-banner/Dog-Activity-BXP135285s.jpg) no-repeat 50% 0; height:220px;}
someothertext #widgetpuffimg{width:100%;position:relative;display:block;}"
newWidgetCSS = widgetCSS.replaceAll("#widgetpuffimg\\{(.*?)\\}","");
我希望字符串中与模式“#widgetpuffimg{anycharacters}”匹配的所有匹配项都被替换为空
导致 newWidgetCSS = someothertext