gpt4 book ai didi

php - 使用正则表达式获取在大括号之间声明的每个 css 类名

转载 作者:太空宇宙 更新时间:2023-11-04 05:30:50 25 4
gpt4 key购买 nike

您好,我正在尝试用 PHP 编写一个简单的 CSS 解析脚本,使我能够将先前声明的类放入 css 规则中,即 less 和 Sassy 的 Mixins 功能。

这个正则表达式只抓取花括号内的最后一个 css 类名:

{.+(\.\w+).+}

例如,在下面的 css 规则中只有 .foo 会被匹配:

.login_form_container  { .gradient .rounded_corners width:431px; height:282px; margin:250px auto 0; .foo }

谢谢!

最佳答案

你为什么不直接使用 lessphp

关于php - 使用正则表达式获取在大括号之间声明的每个 css 类名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3271883/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com