Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了一些可以改变任何
width="any number"
用字符串
$width="300"
像这样 :
$width = 'width="300"' $content = preg_replace( '/width="([0-9]*)"/' , $width , $content );
但是在这段代码中,所有的宽度都发生了变化,所以我希望它只替换超过 300 的宽度
那么我该如何修改我的正则表达式来处理这个?!
谢谢
$content = preg_replace('/width="([3-9][0-9]{2,}|[1-9][0-9]{3,})"/',$width,$content);