Re: removing text from a string

From: Date: Thu, 06 Nov 2008 09:07:25 +0000
Subject: Re: removing text from a string
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-282977@lists.php.net to get a copy of this message
Micah Gersten a écrit :
Yep, with a regex, it's real easy (untested code):
So easy you got two bugs :
<?php $fileData = file_get_contents("text,txt");
I hope you don't really do that in production code. It can be bogus with big files.
$newFileData = preg_replace('/^\d+?\.\s?(.*$)/m','/$1/', $fileData);
Buggy regex. And text,txt is a correct filename, I don't understand why you worry about :D -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org

« previous php.general (#282977) next »