For example, you can enter a string of characters in a text box.
Content entered for the first time: $ w1 = "http://you.video.sina.com.cn/ B /25323843-1272884840.html ";
Second input: $ w2 = "http://v.youku.com/v_show/id_XMzIzNjA2NjE2.html ";
First result: $ val = "25323843 ";
The second result: $ val = "XMzIzNjA2NjE2 ";
Assuming that the above two values are entered by the user separately, how does the program automatically extract the values I need? Can you give an example?
Please help
Reply to discussion (solution)
// Video link processing function url_1 ($ str) {$ ubb_search = array ("/http: \// \/(v | www) .youku.com \/v_show \/id _(. + ?). Html/I ", // 1"/http: \/v.ku6.com \/show \/(. + ?). Html/I ", // 2"/http: \// www.tudou.com \/programs \/view \/(. + ?) \ // I ", // 3"/http: \/you.video.sina.com.cn \/B \/(. + ?) -(. + ?). Html/I ", // 4"/http: \/(. + ?). Joy.cn \/video \/(. + ?). Htm/I ", // 5"/http: \/www.openv.com \/play \/(. + ?). Html/I ", // 6"/http: \/video.pomoho.com \/ent \/(. + ?) /I ", // 7"/http: \/www.weplay.cn \/c2 \/(. + ?). Html/I ", // 8"/http: \/v.blog.sohu.com \/u \/vw \/(. + ?) /I ", // 9 //"/http: \/vlog.17173.com \/v \/(. + ?) \/(. + ?) \/(. + ?) \/(. + ?) /I ", // 10"/http: \// www.letv.com \/ptv \/vplay \/(. + ?) /I ", // 11"/http: \// TV .mofile.com \/([^ \ [\ <\ r \ n] + ?) \ // I ", // 12"/http: \/www.boosj.com \/(. + ?). Html/I ", // 13"/http: \// www.bobmy.com \/FlvMovie \/VIEW (. + ?). Html/I ", // 14"/http: \/v.xgo.com.cn \/(. + ?) \/(. + ?). Html/I ", // 15"/http: \/play. hupo. TV \/(. + ?). Html/", // 16"/http: \// www.nnbbaa.com \/player. php \? Id = (. + ?) /", // 16"/http: \/mv.2u.com.cn \/detail _ (. + ?). Html/", // 18"/http: \// vsearch.cctv.com \/plgs_play-(. + ?). Html/", // 19); $ ubb_replace = array (" ", // 1); $ str_1 = preg_replace ($ ubb_search, $ ubb_replace, $ str ); if ($ str! = $ Str_1) {$ str = 'Recommendation: ';} else {$ str = '';} return $ str ;}
For reference
// Video link processing function url_1 ($ str) {$ ubb_search = array ("/http: \// \/(v | www) .youku.com \/v_show \/id _(. + ?). Html/I ", // 1"/http: \/v.ku6.com \/show \/(. + ?). Html/I ", // 2"/http: \// www.tudou.com \/programs \/view \/(. + ?) \ // I ", // 3"/http: \/you.video.sina.com.cn \/B \/(. + ?) -(. + ?). Html/I ", // 4"/http: \/(. + ?). Joy.cn \/video \/(. + ?). Htm/I ", // 5"/http: \/www.openv.com \/play \/(. + ?). Html/I ", // 6"/http: \/video.pomoho.com \/ent \/(. + ?) /I ", // 7"/http: \/www.weplay.cn \/c2 \/(. + ?). Html/I ", // 8"/http: \/v.blog.sohu.com \/u \/vw \/(. + ?) /I ", // 9 //"/http: \/vlog.17173.com \/v \/(. + ?) \/(. + ?) \/(. + ?) \/(. + ?) /I ", // 10"/http: \// www.letv.com \/ptv \/vplay \/(. + ?) /I ", // 11"/http: \// TV .mofile.com \/([^ \ [\ <\ r \ n] + ?) \ // I ", // 12"/http: \/www.boosj.com \/(. + ?). Html/I ", // 13"/http: \// www.bobmy.com \/FlvMovie \/VIEW (. + ?). Html/I ", // 14"/http: \/v.xgo.com.cn \/(. + ?) \/(. + ?). Html/I ", // 15"/http: \/play. hupo. TV \/(. + ?). Html/", // 16"/http: \// www.nnbbaa.com \/player. php \? Id = (. + ?) /", // 16"/http: \/mv.2u.com.cn \/detail _ (. + ?). Html/", // 18"/http: \// vsearch.cctv.com \/plgs_play-(. + ?). Html/", // 19); $ ubb_replace = array (" ", // 1); $ str_1 = preg_replace ($ ubb_search, $ ubb_replace, $ str ); if ($ str! = $ Str_1) {$ str = 'Recommendation: ';} else {$ str = '';} return $ str ;}
For reference
This should have been taken out of discuz, right?
// Video link processing function url_1 ($ str) {$ ubb_search = array ("/http: \// \/(v | www) .youku.com \/v_show \/id _(. + ?). Html/I ", // 1"/http: \/v.ku6.com \/show \/(. + ?). Html/I ", // 2"/http: \// www.tudou.com \/programs \/view \/(. + ?) \ // I ", // 3"/http: \/you.video.sina.com.cn \/B \/(. + ?) -(. + ?). Html/I ", // 4"/http: \/(. + ?). Joy.cn \/video \/(. + ?). Htm/I ", // 5"/http: \/www.openv.com \/play \/(. + ?). Html/I ", // 6"/http: \/video.pomoho.com \/ent \/(. + ?) /I ", // 7"/http: \/www.weplay.cn \/c2 \/(. + ?). Html/I ", // 8"/http: \/v.blog.sohu.com \/u \/vw \/(. + ?) /I ", // 9 //"/http: \/vlog.17173.com \/v \/(. + ?) \/(. + ?) \/(. + ?) \/(. + ?) /I ", // 10"/http: \// www.letv.com \/ptv \/vplay \/(. + ?) /I ", // 11"/http: \// TV .mofile.com \/([^ \ [\ <\ r \ n] + ?) \ // I ", // 12"/http: \/www.boosj.com \/(. + ?). Html/I ", // 13"/http: \// www.bobmy.com \/FlvMovie \/VIEW (. + ?). Html/I ", // 14"/http: \/v.xgo.com.cn \/(. + ?) \/(. + ?). Html/I ", // 15"/http: \/play. hupo. TV \/(. + ?). Html/", // 16"/http: \// www.nnbbaa.com \/player. php \? Id = (. + ?) /", // 16"/http: \/mv.2u.com.cn \/detail _ (. + ?). Html/", // 18"/http: \// vsearch.cctv.com \/plgs_play-(. + ?). Html/", // 19); $ ubb_replace = array (" ", // 1); $ str_1 = preg_replace ($ ubb_search, $ ubb_replace, $ str ); if ($ str! = $ Str_1) {$ str = 'Recommendation: ';} else {$ str = '';} return $ str ;}
For reference
This should have been taken out of discuz, right?
// Video link processing function url_1 ($ str) {$ ubb_search = array ("/http: \// \/(v | www) .youku.com \/v_show \/id _(. + ?). Html/I ", // 1"/http: \/v.ku6.com \/show \/(. + ?). Html/I ", // 2"/http: \// www.tudou.com \/programs \/view \/(. + ?) \ // I ", // 3"/http: \/you.video.sina.com.cn \/B \/(. + ?) -(. + ?). Html/I ", // 4"/http: \/(. + ?). Joy.cn \/video \/(. + ?). Htm/I ", // 5"/http: \/www.openv.com \/play \/(. + ?). Html/I ", // 6"/http: \/video.pomoho.com \/ent \/(. + ?) /I ", // 7"/http: \/www.weplay.cn \/c2 \/(. + ?). Html/I ", // 8"/http: \/v.blog.sohu.com \/u \/vw \/(. + ?) /I ", // 9 //"/http: \/vlog.17173.com \/v \/(. + ?) \/(. + ?) \/(. + ?) \/(. + ?) /I ", // 10"/http: \// www.letv.com \/ptv \/vplay \/(. + ?) /I ", // 11"/http: \// TV .mofile.com \/([^ \ [\ <\ r \ n] + ?) \ // I ", // 12"/http: \/www.boosj.com \/(. + ?). Html/I ", // 13"/http: \// www.bobmy.com \/FlvMovie \/VIEW (. + ?). Html/I ", // 14"/http: \/v.xgo.com.cn \/(. + ?) \/(. + ?). Html/I ", // 15"/http: \/play. hupo. TV \/(. + ?). Html/", // 16"/http: \// www.nnbbaa.com \/player. php \? Id = (. + ?) /", // 16"/http: \/mv.2u.com.cn \/detail _ (. + ?). Html/", // 18"/http: \// vsearch.cctv.com \/plgs_play-(. + ?). Html/", // 19); $ ubb_replace = array (" ", // 1); $ str_1 = preg_replace ($ ubb_search, $ ubb_replace, $ str ); if ($ str! = $ Str_1) {$ str = 'Recommendation: ';} else {$ str = '';} return $ str ;}
For reference
This should have been taken out of discuz, right?
$w1=" http://you.video.sina.com.cn/b/25323843-1272884840.html";$w2="http://v.youku.com/v_show/id_XMzIzNjA2NjE2.html";preg_match('/\/(\d+)-/',$w1,$m1);preg_match('/id_(.+?)\./',$w2,$m2);echo $m1[1];echo '
';echo $m2[1];
25323843
XMzIzNjA2NjE2
$w1=" http://you.video.sina.com.cn/b/25323843-1272884840.html";$w2="http://v.youku.com/v_show/id_XMzIzNjA2NjE2.html";preg_match('/\/(\d+)-/',$w1,$m1);preg_match('/id_(.+?)\./',$w2,$m2);echo $m1[1];echo '
';echo $m2[1];
25323843
XMzIzNjA2NjE2
Thank you ~~~~