100分求正则表达式 急。在线等 preg_match_all('/1(.+)2/U',$str,$matches); print_r($matches[1]); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php//By mrshelly$str="1fdsafdsa2fdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsaf1fdsafdsa21fdsafds2";print_r(split(' ',trim(str_replace(array('1','2'),' ',$str))));?> preg_match_all('/1(.*?)2/U',$str,$matches); print_r($matches[1]); $str="1fdsafdsa2fdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsaf1fdsafdsa21fdsafds2";print_r(split(' ',trim(str_replace(array('1','2'),' ',$str))));这个不符合吧,这样会把1和1之间,2和2之间,1和2之间,2和1之间的都包括了,而不是楼主的1和2之间preg_match_all('/1(.+)2/U',$str,$matches); print_r($matches[1]);这个看似可以,但如果中间有连续两个1就会截错了(x1xxx1xxx2x这样的)我来写一个,呵呵preg_match_all('/1([^1.]+)2/U',$str,$matches); print_r($matches[1]); 求助3 RewriteRule的问题 php exec执行linux命令问题,麻烦各位高手帮忙看下 关于搜索技术问题 关于preg_match的问题 如何捕捉warning错误? 关于SQL攻击。。。。。。PHP中MYSQL一条语句不能做多次查询?????急。。。。 如asp中request.servervariables("query_string")在php中该怎么写才能实现? 【微信公众号二次开发】接收用户图片存储到服务器问题 thinkphp3.2.3用pdo连接数据库连接不上 组团创业,想做点事的进来看看。 一个小小的外包项目,花不到1个小时(200元)~有兴趣的请进!
//By mrshelly
$str="1fdsafdsa2fdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsa1fdsafdsa2fdsafdsaf1fdsafdsa21fdsafds2";
print_r(split(' ',trim(str_replace(array('1','2'),' ',$str))));
?>
print_r($matches[1]);
print_r(split(' ',trim(str_replace(array('1','2'),' ',$str))));
这个不符合吧,这样会把1和1之间,2和2之间,1和2之间,2和1之间的都包括了,而不是楼主的1和2之间
preg_match_all('/1(.+)2/U',$str,$matches);
print_r($matches[1]);
这个看似可以,但如果中间有连续两个1就会截错了(x1xxx1xxx2x这样的)
我来写一个,呵呵
preg_match_all('/1([^1.]+)2/U',$str,$matches);
print_r($matches[1]);