If you haven't heard, the do-file editor in Stata 11 comes with proper syntax highlighting, folding, etc. That means that this post will be obsolete as soon as I upgrade, unless the new do-file editor doesn't do regular expression-based find and replace. No matter. In the meantime, here goes:
People often post code on Statalist and sometimes this code comes from the Stata results window. The difference, as far as code is concerned, is that the command window outputs commands preceded by a dot-blank -- as in
. display "hello" instead of
Such dot-blanks need to be cleaned up before Stata can run this code. Notepad++ has a regular expression search option. All you have to do is look for
^\. and replace it with nothing. The ^ sign means that you're only looking at the beginning of each line. The backslash escapes the period, which has special meaning in regular expressions. The blank after the dot is optional.
So there. I just did it because I wanted to replicate a neat little simulation.