$re = '/\/(?<form>[^\/]*)\/\d+\/(?<rule>[^\/]*)\/\w+\/(?<mode>[^\/]*)/';
$str = 'http://linear-scope010.abc.com/LIVE/1002/hls/ae/TWAMCPH/98.m3u8
http://mmdai-linear-west-03.abc.com/linear-scope010.abc.com/LIVE/1008/hls/ae/Nat_HD/.swn71c39e69-9b76-45a0-a2da-005056b23b1dapple2apple/.rate_2737280/index_v_2737280_6.m3u8?nw=376521≺of=376521:twc_hls_live&mode=live&vdur=600&caid=NGC_LIVE&csid=stva_android_ph_live&vcid=369573a4-4f5b-3aa7-a42b-2eec0477efda&z5=79912&ads=VAST_LIVE&tagset_name=VAST&_fw_lpu=http://linear-scope010.abc.com/LIVE/1008/hl...';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php