[UPHPU] Regex help.

thebigdog bigdog at venticon.com
Fri Jan 30 13:58:56 MST 2009


> #!/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


More information about the UPHPU mailing list