How to remove lines that begin with spaces in Notepad++

notepadregex

I need to remove lines that begin with spaces (the entire line, not just the spaces)

Here is an example of the file I'm working with:

41. 415607DB (AV-2011) 2007-06-23 (1D0703A2) (572D8DEC)
42. 415607DC (AV-2012) 2007-06-21 (4A5E805B) (73A29D08)
                       2009-11-18 (F830F241) (11F8A118)
43. 415607DD (AV-2013) 2007-07-12 (2D92F988) (2CB96AE4)
44. 415607DE (AV-2014) 2009-08-18 (A8E5F41B) (614BF7F6)
45. 415607DF (AV-2015) 2008-06-21 (8A3A88B8) (3B7CBB2D)
46. 415607E0 (AV-2016) 2011-03-29 (EF1BE81D) (2641EDA1)
                       2007-06-27 (7C19F25E) (1B17FCD8)
47. 415607E1 (AV-2017) 2007-11-21 (608D1D2F) (720B9353)
                       2007-11-29 (E55CEF10) (1BB2F934)
                       2007-06-21 (DD85E9F6) (2E07093A)
48. 415607E2 (AV-2018) 2009-07-07 (3D7B9FC0) (0F8AB402)

Here is the output I'm hoping to obtain:

41. 415607DB (AV-2011) 2007-06-23 (1D0703A2) (572D8DEC)
42. 415607DC (AV-2012) 2007-06-21 (4A5E805B) (73A29D08)
43. 415607DD (AV-2013) 2007-07-12 (2D92F988) (2CB96AE4)
44. 415607DE (AV-2014) 2009-08-18 (A8E5F41B) (614BF7F6)
45. 415607DF (AV-2015) 2008-06-21 (8A3A88B8) (3B7CBB2D)
46. 415607E0 (AV-2016) 2011-03-29 (EF1BE81D) (2641EDA1)
47. 415607E1 (AV-2017) 2007-11-21 (608D1D2F) (720B9353)
48. 415607E2 (AV-2018) 2009-07-07 (3D7B9FC0) (0F8AB402)

Best Answer

  • Ctrl+H
  • Find what: ^\h+.*$\R?
  • Replace with: LEAVE EMPTY
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

^           # beginning of line
  \h+       # 1 or more horizontal spaces
  .*        # 0 or more any character but newline
$           # end of line
  \R?       # optional linebreak

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Related Question