fork(7) download
  1. <?php
  2. $mycss = '@font-face
  3. {
  4. font-family: "din";
  5. src: url("din-webfont.eot");
  6. src: url("din-webfont.eot?#iefix") format("embedded-opentype"), url("din-webfont.woff") format("woff"), url("din-webfont.ttf") format("truetype");
  7. font-weight: normal;
  8. font-style: normal;
  9. }
  10. @font-face
  11. {
  12. font-family: "din";
  13. src: url("din_bold-webfont.eot");
  14. src: url("din_bold-webfont.eot?#iefix") format("embedded-opentype"), url("din_bold-webfont.woff") format("woff"), url("din_bold-webfont.ttf") format("truetype");
  15. font-weight: bold;
  16. font-style: normal;';
  17.  
  18. $fontregex = '~@font-face[^}]*?font-family:\s*"([^"]+)"[^}]*?font-weight:\s*([^;]+);[^}]*?font-style:\s*([^;]+);~';
  19. preg_match_all($fontregex, $mycss, $matches,PREG_SET_ORDER);
  20. print_r($matches);
  21.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => @font-face
{
    font-family: "din";
    src: url("din-webfont.eot");
    src: url("din-webfont.eot?#iefix") format("embedded-opentype"),  url("din-webfont.woff") format("woff"), url("din-webfont.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
            [1] => din
            [2] => normal
            [3] => normal
        )

    [1] => Array
        (
            [0] => @font-face
{
    font-family: "din";
    src: url("din_bold-webfont.eot");
    src: url("din_bold-webfont.eot?#iefix") format("embedded-opentype"), url("din_bold-webfont.woff") format("woff"), url("din_bold-webfont.ttf") format("truetype");
    font-weight: bold;
    font-style: normal;
            [1] => din
            [2] => bold
            [3] => normal
        )

)