常用正则 持续更新....

1.匹配:之后的内容

$blueurl= "127.0.0.1:1.txt";
$reg = "(?<=\d:).*";
preg_match("/(?<=\d:).*/",$blueurl, $matches);

2.匹配[]内的内容

$rule = "/submit_data\[([^\]]*)\]/i";
 preg_match($rule,$value,$results);

3.正则匹配a标签间的内容

$author=$forum['lastpost']['author']; //获取a标签字符串
$match='/<a href="[^"]*"[^>]*>(.*)<\/a>/';//a标签正则匹配
preg_match_all($match,$author,$arr); //开始匹配

猜你喜欢

转载自blog.csdn.net/qq_41467799/article/details/84314792