fork download
  1. <?php
  2.  
  3. $re = '~\bpool\h+/\K\S+$~m';
  4. $str = "when HTTP_REQUEST {\nswitch -glob [string tolower [HTTP::host]] {\n \"sub1.sub.dom\" {\n pool /networkname/hostname_80\n }\n \"sub2.sub.dom\" {\n pool /anothernetworkname/anotherhostname_80\n }\n default {\n drop \n }\n}\n}";
  5. if (preg_match_all($re, $str, $matches)) {
  6. print_r($matches[0]);
  7. }
Success #stdin #stdout 0.01s 23980KB
stdin
Standard input is empty
stdout
Array
(
    [0] => networkname/hostname_80
    [1] => anothernetworkname/anotherhostname_80
)