Re: removing text from a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux