Re: removing text from a string

From: Date: Thu, 06 Nov 2008 07:47:11 +0000
Subject: Re: removing text from a string
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-282972@lists.php.net to get a copy of this message
On Wed, 2008-11-05 at 18:50 -0600, Micah Gersten wrote: > > Yep, with a regex, it's real easy (untested code): > > > > <?php > > > > $fileData = file_get_contents("text,txt"); > > $newFileData = preg_replace('/^\d+?\.\s?(.*$)/m','/$1/', $fileData); > > file_put_contents("newfile.txt", $newFileData); > > > > ?> > > > > Thank you, > > Micah Gersten > > onShore Networks > > Internal Developer > > http://www.onshore.com > > > > > > > > I guess I forgot to proofread also. > filename should have a period, not a comma. > You did say it was untested code ;) Ash www.ashleysheridan.co.uk

« previous php.general (#282972) next »