求一个php正则表达 $a = "abc@123 abc"正则表达式 获取到 @和空格中间的这个字符串结果应该是 "123"~坐等 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 preg_match('/@(.*?) /',$a,$m);echo $m[1]; 得出来是数组 array(2) { [0] => string(5) "@asj " [1] => string(3) "asj"} $a = "132h@asj asd"; preg_match('/@(.*?) /',$a,$m);ehco $m;出来是数组型Arrayprint_r($m);得出来是数组 array(2) { [0] => string(5) "@asj " [1] => string(3) "asj"} 我想直接得出来字符串...才看到是你 echo $m[1]; [User:root Time:23:10:40 Path:/home/liangdong/php]$ php preg.php Array( [0] => abc@123 [1] => 123)[User:root Time:23:10:40 Path:/home/liangdong/php]$ cat preg.php <?php$content = <<<EOFabc@123 abcEOF;$nmatches = preg_match('/\w+@(\w+)/s', $content, $matches);print_r($matches);?> 在线投票系统出现的一点小问题 商信通接口调用,求助 求助一个sql语句 表格,分3列输入 獲取某一時間戮是一年中的第幾周用哪個函數? php 数组。 ■■100分全给一个人,如何使用PHP4.1自带的zip库生成一份压缩文件 求教高手,关于日文编码的问题,急, 关于php4.2中用url传递变量的问题!!!! 搜索什么关键字才能找到数据库类呢 关于php数据备份 一个奇怪的问题
echo $m[1];
array(2) {
[0] => string(5) "@asj "
[1] => string(3) "asj"
}
preg_match('/@(.*?) /',$a,$m);
ehco $m;
出来是数组型Array
print_r($m);
得出来是数组
array(2) {
[0] => string(5) "@asj "
[1] => string(3) "asj"
}
才看到是你 echo $m[1];
Array
(
[0] => abc@123
[1] => 123
)
[User:root Time:23:10:40 Path:/home/liangdong/php]$ cat preg.php
<?php
$content = <<<EOF
abc@123 abc
EOF;
$nmatches = preg_match('/\w+@(\w+)/s', $content, $matches);
print_r($matches);
?>