正则太菜

WBOY
Release: 2016-06-13 10:25:06
Original
990 people have browsed it

正则太菜,求助
$s = 'aaa.bbb.ccc.ddd...';
如何用正则替换成a.b.c.d...



------解决方案--------------------

PHP code
$s = 'aaa.bbb.ccc.ddd...';echo preg_replace('/([a-z])+/i','\1',$s);<br><font color="#e78608">------解决方案--------------------</font><br>$s = 'aaa.bbb.ccc.ddd...';<br>echo preg_replace('/(\w)+/', '$1', $s); //a.b.c.d...<br><div class="clear">
                 
              
              
        
            </div>
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