Skip to content

Instantly share code, notes, and snippets.

@swanandp
Created July 15, 2011 07:35
Show Gist options
  • Save swanandp/1084250 to your computer and use it in GitHub Desktop.
Save swanandp/1084250 to your computer and use it in GitHub Desktop.
Regular Expression to remove Blank Lines, but keep indentation on other lines
# Regular expression for removing blank lines from a text:
#Replace this regex
/(\s+)^\r?\n?$(\s+)/mix
# With
$2 # The second match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment