News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sean Coates' Blog:
PHP Pie?
February 19, 2007 @ 08:20:00

Sean Coates has created a simple version of a popular bit of Perl functionality and shares the code in hi slatest post - the "pie" ability to perform a search and replace, line by line, through a file using a regular expression.

I've often found myself looking for a PHP equivalent. Not to do simple substitutions, of course, but complex ones. And since I'm most comfortable with PHP, and a I have a huge library of snippets that I can dig out to quell a problem that I may have solved years ago, I've been meaning to fill this void for a while.

So, one evening, he came home and hashed out this version of the script. He includes the code in the post...it works on the command line and pulls in a file (though STDIN) and loops through the buffered version to perform the regex replace.

0 comments voice your opinion now!
perl pie parse regularexpression example replace search perl pie parse regularexpression example replace search


blog comments powered by Disqus

Similar Posts

DevShed: Completing a Search Engine with MySQL and PHP 5

Pierre-Alain Joye's Blog: Finally some new features are coming, zip-1.9.0 serie began

Richard Miller's Blog: Essential PHP Security

Luc de Brouwer's Blog: Never having to use $_GET or $_POST again

Jan Lehnardt's Blog: Using the Zend Framework with Code Igniter (an alternative)


Community Events





Don't see your event here?
Let us know!


language zendserver podcast series symfony interview tips introduction bugfix list community voicesoftheelephpant developer framework api library deployment conference laravel release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework