On Fri, Jan 30, 2009 at 1:58 PM, thebigdog <[email protected]> wrote:

> #!/usr/bin/php -q
>>
>> <?PHP
>>
>> $contents=file_get_contents("file.txt");
>>
>> preg_replace('^A-Za-z','',$contents);
>>
>> file_put_contents("file.txt",$contents);
>>
>> ?>
>>
>
> you need to make sure you have the [] around your characters like this:
>
> preg_replace('[^A-Za-z]','',$contents);
>
> and you might need to extend that regex out some...do you have a data
> example.
>
> --
> thebigdog



Sometimes using preg_replace I get some errors, when this happends you need
to add a / at the start and the end of the regular expresion:

preg_replace('/^[A-Za-z]/', '', $contents);

regards

--------
keogh

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to