Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

求正则表达式

[复制链接]
redtamo 发表于 2009-9-16 16:02:46 | 显示全部楼层 |阅读模式
问个正则的问题,类似信息采集:
我有很长一段字符串str,其中包含很多下面这样的小段内容:
"contactName":"这个引号里面的内容是我想要的 数据","email"

我想使用preg_match_all函数把这些招到的数据放在arr数组中,请问正则该怎么写啊
回复

使用道具 举报

云天一 发表于 2009-9-16 16:18:53 | 显示全部楼层
本帖最后由 云天一 于 2009-9-16 16:19 编辑
  1. <?php
  2. $str = 'sadfasdfasdfsadfds"contactName":"这个引号里面的内容是我想要的 数据","email"sdfasdffdsaf';
  3. preg_match("/"contactName":"(.*)","email"/", $str, $match);
  4. var_dump($match[1]);
  5. ?>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-10 23:11 , Processed in 0.111543 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表