Let's go with r'#\s[^\n]*\n', which will be faster because it won't have to continually backtrack. (Yes, we're doing better than the single-line-JS-comment regex that ships with Pygments and that you probably based this on.)