fork(2) download
  1. <?php
  2.  
  3. $string = '[to_custom_font family="Lato;900italic" decoration="" style="normal"]Content[/to_custom_font] //parent shortcode
  4. [to_section attr="" attr3=""]
  5. [to_custom_font family="Lato;900italic" decoration="" style="normal"]Content[/to_custom_font]//child shortcode
  6. [/to_section]';
  7.  
  8. preg_match_all('/family="([^"]+)"/', $string, $matches);
  9.  
  10. foreach ($matches[1] as $match) {
  11. echo $match . "\n";
  12. }
  13.  
  14. print_r($matches);
  15.  
  16. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Lato;900italic
Lato;900italic
Array
(
    [0] => Array
        (
            [0] => family="Lato;900italic"
            [1] => family="Lato;900italic"
        )

    [1] => Array
        (
            [0] => Lato;900italic
            [1] => Lato;900italic
        )

)