Re: removing text from a string

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

 



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


-- 
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