codehaven - php snippets - coding help
Generic filters
Exact matches only
  • Remove empty lines and spaces in Notepad2

    29th August 2014

    Random Coding

    random coding category codehaven

    To get rid of leading space(s) and all empty lines (even if the empty line contains spaces or tabs)

    Go to Search -> Replace
    Select “Regular expression” under Search mode.
    Use ^\s* for “Find what” and leave “Replace with” blank.
    Click Replace all

    For just spaces use \s*

    Regex explanation:

    ^ means beginning of the line
    \s* means any number (even 0) of whitespace characters. Whitespace characters include tab, space, newline, and carriage return.

    Was this code snippet helpful?