Re: removing text from a string
| From: | Micah Gersten | Date: | Thu, 06 Nov 2008 00:50:59 +0000 |
| Subject: | Re: removing text from a string | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282962@lists.php.net to get a copy of this message | ||
> 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.