Home > Backend Development > PHP Tutorial > 求一行正则表达式,哪位能帮帮忙?

求一行正则表达式,哪位能帮帮忙?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:48:55
Original
1195 people have browsed it

求一行正则表达式,哪位能帮帮忙?

准备在这个软件里用

如果含有 “问答”、“百度”、"搜索" 这三个词当中的任意一个或几个,就把这几个词提取出来,并用逗号隔开

回复内容:

求一行正则表达式,哪位能帮帮忙?

准备在这个软件里用

如果含有 “问答”、“百度”、"搜索" 这三个词当中的任意一个或几个,就把这几个词提取出来,并用逗号隔开

<?php
preg_match_all('#(问答|百度|搜索)#ius','如果含有"问答"、"百度"、...',$matches);
print_r($matches[1]); //Array ( [0] => 问答 [1] => 百度 )
echo implode(',', $matches[1]); //问答,百度
Copy after login

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template