fork download
  1. <?php
  2.  
  3. $str = "differentcontentLocationhttps://e...content-available-to-author-only...e.com/api/result/13548/data/123456differentstuffincludingwhitespacesandnewlines8484";
  4. $str2 = "differentcontentLocationhttps://e...content-available-to-author-only...e.com/api/result/13548/data/123456";
  5. preg_match("@/data/([0-9]+)@i", $str, $matches);
  6. print_r($matches);
  7. preg_match("@/data/([0-9]+)@i", $str2, $matches2);
  8. print_r($matches2);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => /data/123456
    [1] => 123456
)
Array
(
    [0] => /data/123456
    [1] => 123456
)