正则表达式使用 preg_match 抓取内容
这是需要 preg_matched 的文本。
/* * product 2: * catalogServiceType = 2 * catalogCacheType = 1 * catalog2RemoteCacheActive = false */ var objProduct881705 = new ProductStyle("2","881705","","4149367","247",false,false,false,false,'','',"35401",false,'$79.50',true,false,false,false,0,false,true,false,true,99,5,"First content that needs to be matched",'Color',"","Machine.","","false","false","false",0,0,"C1","1","",true);obj={'S':'http://domainname.com/mini/image.jpg', 'L':'http://domainname.com/main/image.jpg'};
我希望能够从上面的文字中获取以下内容:
1. First content that needs to be matched
2. http://domainname.com/main/image.jpg
您建议我如何做到这一点?
Here is the text that needs to be preg_matched.
/* * product 2: * catalogServiceType = 2 * catalogCacheType = 1 * catalog2RemoteCacheActive = false */ var objProduct881705 = new ProductStyle("2","881705","","4149367","247",false,false,false,false,'','',"35401",false,'$79.50',true,false,false,false,0,false,true,false,true,99,5,"First content that needs to be matched",'Color',"","Machine.","","false","false","false",0,0,"C1","1","",true);obj={'S':'http://domainname.com/mini/image.jpg', 'L':'http://domainname.com/main/image.jpg'};
I would like to be able to grab the following from the text above:
1. First content that needs to be matched
2. http://domainname.com/main/image.jpg
How do you propose I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正则表达式新手在这里,得到了一些东西:
Regex newbie here, got something with that:
我是这样解决的:
Here is how I solved it: