Remove blank lines with Regex and AltSearch

I am trying to match any spaces or blank lines in this test file using AltSearch . For some reason, I cannot match the space between bar bar and line 4.

Here is a test file. To send it to Stack Overflow, I changed the spaces to periods and tabs in TAB. (When you change it for personal testing, note that TABTABTAB is below line 3, it is easy to overlook it).

 line1 line2 ..............TAB line3 TABTABTAB foo foo bar bar line4 TAB.............. line5 ................. line6 

And here are 2 versions of my regex. Both work the same for me.

 \p*^\s*\t*\p+ \p*^(\s||\t)*\p+ 

I know the script package inside AltSearch will be a simpler way (and I already have a working batch). My interest is not to use the package.

Also does not work. I don’t understand, maybe this AltSearch is just buggy, damn it?

 (\p*^\s*\p+)||(\p*^\p*) 
+5
source share
1 answer

Use the following regex

 ^$ 

Make sure you select the Regular Expressions check box after expanding the Other Options section.

Screenshot

Here is a screenshot from Help in LibreOffice

reference

Ideally ^\s*$ should work as I comment , it is strange that it does not work in LO.

+1
source

Source: https://habr.com/ru/post/1270350/


All Articles