For example, a user enters a string of characters through a text box
First input content: $w 1= "http://you.video.sina.com.cn/b/25323843-1272884840.html";
The second input content: $w 2= "http://v.youku.com/v_show/id_XMzIzNjA2NjE2.html";
The results obtained for the first time: $val = "25323843";
The result of the second time: $val = "Xmziznja2nje2";
Assuming that the above two values are entered separately by the user themselves, how can the program automatically extract the values I need? Can you give me an example?
Please help us.
Reply to discussion (solution)
For 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\/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
For 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\/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 is supposed to be taken from the Discuz, right?
For 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\/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 is supposed to be taken from the Discuz, right?
For 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\/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 is supposed to be taken from the Discuz, right?
$w 1= "http://you.video.sina.com.cn/b/25323843-1272884840.html", $w 2= "http://v.youku.com/v_show/id_ Xmziznja2nje2.html ";p reg_match ('/\/(\d+)-/', $w 1, $m 1);p reg_match ('/id_ (. +?) \./', $w 2, $m 2); Echo $m 1[1];echo '
'; echo $m 2[1];
25323843
Xmziznja2nje2
$w 1= "http://you.video.sina.com.cn/b/25323843-1272884840.html", $w 2= "http://v.youku.com/v_show/id_ Xmziznja2nje2.html ";p reg_match ('/\/(\d+)-/', $w 1, $m 1);p reg_match ('/id_ (. +?) \./', $w 2, $m 2); Echo $m 1[1];echo '
'; echo $m 2[1];
25323843
Xmziznja2nje2
Thank you ~ ~ ~