Parsing CSS by regex

前端 未结 8 1760
时光说笑
时光说笑 2020-11-27 17:37

I\'m creating a CSS editor and am trying to create a regular expression that can get data from a CSS document. This regex works if I have one property but I can\'t get it to

8条回答
  •  眼角桃花
    2020-11-27 18:25

    Do not use your own regex for parsing CSS. Why reinvent the wheel while there is code waiting for you, ready to use and (hopefully) bug-free?

    There are two generally available classes that can parse CSS for you:

    HTML_CSS PEAR package at pear.php.net

    and

    CSS Parser class at PHPCLasses:

    http://www.phpclasses.org/browse/package/1289.html

提交回复
热议问题