在“正则表达式”里有个“分组”的概念,用()实现的,请问,这个“分组”的作用是什么啊? 在“正则表达式”里有个“分组”的概念,用()实现的,请问,这个“分组”的作用是什么啊,到哪些场合要用到? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 查aa与bb之间的数字<?php$str = '111aa222bb333cc444';preg_match('/aa(\d+)bb/',$str,$m);var_dump($m[1]);?> $name ="fruit like {apple},{orange} and so on";preg_match_all('/{([a-z]*)}/U',$name,$arr);print_r($arr); 把正则好好看一下分组用到的地方很多,在很多函数里面起到的作用也不一样的写了二个小例子,LZ可以看一下//要求从下面字符串中提取所有域名$str= <<<strhttp://www.abc.com/register.php?username=phpboy005www.def.com/register.php?username=phpboy005ghi.com/register.php?username=phpboy005str;preg_match_all('/(http:\/\/)?(www.)?(.+)\//', $str, $matches); print_r($matches[0]);//把$str里所有的域名改成csdn.net$str = preg_replace('/(http:\/\/)?(www.)?(.+)\//', '$1$2csdn.net/', $str);echo $str; ()就是整体配匹,如果配匹了那么会记录起来可以 后面可以使用\1引用。 -----------------------------------------新型ORM queryphp框架简介和教程入门http://topic.csdn.net/u/20100228/22/3bea834b-efc0-4aa0-af4a-a4923af8b60c.htmlhttp://topic.csdn.net/u/20100226/12/43bf3dc5-795f-4fa5-861a-2f7bf8fd0cd6.html下载http://code.google.com/p/queryphp/downloads/list 上传照片页面,调用后,不出提示信息 liux 目录下自动生成文件夹, 匹配,用正则最好,不行的话也请尽量简化 PHP刚入门... 这个简单的查询有错么? 请问,关于PHP读XML数据 我来问问题,两个问题,大家捧场阿。。。 类中的成员函数是否不能返回static类型? 如何把新闻主题和新闻内容写到数据库里去? 如何将curl_exec()返回的stream转换为string 新版的zend studio11.0创建PHP文件没有结尾的标示符 想找份在武汉干PHP的活好难 求这个题目的具体代码答案
<?php
$str = '111aa222bb333cc444';
preg_match('/aa(\d+)bb/',$str,$m);
var_dump($m[1]);
?>
preg_match_all('/{([a-z]*)}/U',$name,$arr);
print_r($arr);
$str= <<<str
http://www.abc.com/register.php?username=phpboy005
www.def.com/register.php?username=phpboy005
ghi.com/register.php?username=phpboy005
str;preg_match_all('/(http:\/\/)?(www.)?(.+)\//', $str, $matches); print_r($matches[0]);//把$str里所有的域名改成csdn.net
$str = preg_replace('/(http:\/\/)?(www.)?(.+)\//', '$1$2csdn.net/', $str);echo $str;
新型ORM queryphp框架简介和教程入门
http://topic.csdn.net/u/20100228/22/3bea834b-efc0-4aa0-af4a-a4923af8b60c.html
http://topic.csdn.net/u/20100226/12/43bf3dc5-795f-4fa5-861a-2f7bf8fd0cd6.html
下载
http://code.google.com/p/queryphp/downloads/list