Removing line numbers from a source code

At the moment I’m learning developping eclipse plugins for my work. Therefore I had to copy some code 1 from this tutorial. Unfortunately I had to remove the stupid line numbers. It’s best to let remove them by a script. Because I spent a lot of time in WordPress plugin development few weeks ago I chose PHP to do the work.

". preg_replace("/\d+\./", "", $code) ."


The script is self descriptive but be sure that you adopt the regular expression to your needs. The regex I used destroys code containing constructs like anyObject12.doAnything();

  1. Copy & paste is bad but 200 lines are too many to rewrite ;-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>