How PHP intercepts specific paragraphs
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.
Share to:
------Solution--------------------
for video link processing
function Url_1 ($STR)
{
$ubb _search = Array ("/http:\/\/(v
------Solution--------------------
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 = ' recommended: ';}
else{
$str = ";
}
return $str;
}
For reference
------Solution--------------------
$w 1= "http://you.video.sina.com.cn/b/25323843-1272884840.html";
$w 2= "http://v.youku.com/v_show/id_XMzIzNjA2NjE2.html";
Preg_match ('/\/(\d+)-/', $w 1, $m 1);
Preg_match ('/id_ (. +?) \./', $w 2, $m 2);
echo $m 1[1];
Echo '
';
echo $m 2[1];
25323843
Xmziznja2nje2