Home > Backend Development > PHP Tutorial > 求php正则.该如何解决

求php正则.该如何解决

WBOY
Release: 2016-06-13 12:57:41
Original
845 people have browsed it

求php正则..
例如:$a = "测试(abc)";我想将"(abc)"一并去掉,这个括号可能是"()、()"这两种格式..求正则一条..
------解决方案--------------------
echo preg_replace('/\(.*?\)/','',$a);
------解决方案--------------------
楼上说了一半

$a = strtr($a, array('(' => '(', ')' => ')'));<br />
echo preg_replace('/\(.*?\)/','',$a);
Copy after login

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template