请教PHP用正则表达式字符串,只想保留第一个该怎么做

WBOY
Release: 2016-06-13 12:39:31
Original
1172 people have browsed it

请问PHP用正则表达式字符串,只想保留第一个该如何做?
PHP
比如说这个字符串有很多个asd,有连续几个的,也有只是一个的,

但是我想只保留第一个asd,后面的asd全部删掉,该怎么做?

(在不影响其他字符的基础上)


ssssssssgsdfasdasdasdasdjlkjhkjhalkasdasdjsdkajshdasdaklsjdasdhkjashgdaklsh

想要的结果:



ssssssssgsdfasdjlkjhkjhalkjsdkajshdaklsjdhkjashgdaklsh

求高手给点提示

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!