Notepad++ search by ignoring whitespace? - full-text-search

Dreamweaver has a very convenient search option at its "Find and Replace" dialog called "Ignore whitespace".
By checking that, you can find the same text no matter how many new lines, tabs or spaces you add or remove. All these variations below are the same text:
search for me please
(adding some blank spaces)
search for me please
(adding a new line)
search for me
please
How can I search with Notepad++ while ignoring all the whitespace?

Actually, it's quite not convenient to do that in notepad++.
1.You can Go to Search -> Replace
2.Select "Regular expression" under Search mode
3.Use \s* to replace space in your sentence for Find what and leave Replace with blank
4.Click Find Next
In your case, input "search\s*for\s*me\s*please" in Find what
'\s*' means any number (even 0) of whitespace characters. Whitespace characters include tab,space,newline and carriage return.

Related

Remove duplicates lines but not blank lines in Sublime Text

I know that you can remove duplicate lines by doing Edit>Permute Lines>Unique. But that will remove blank(empty) lines. I would like not to remove them, so blank lines will stay(essentially empty space).
You can do this using Permute Selections. First, open the Find menu (CtrlF or Find → Find…) and make sure the Regex, Wrap, and Highlight matches buttons are selected. In the search field, enter ^.+\n. This matches the beginning of the line ^, 1 or more characters of any type .+, and the newline character(s). Therefore, it will select any line that is NOT just a newline. Note that this will select lines that contain only whitespace, for example a tab character followed by a newline.
Next, hit the Find All button to select each line individually.
Finally, select Edit → Permute Selections → Unique and all duplicate lines will be erased, leaving all blank lines behind.

InDesign data merge—"remove blank lines" resulting in extra characters

I'm using data merge to import two variables per line, and have checked the "Remove blank lines for empty fields" box. The result is a wealth of extra characters that I can't remove using find-and-replace. Of the 24 lines of variables, typically only three contain text, so the other 21 should be empty lines and be deleted by the "Remove blank lines" option.
Attempting to paste these characters into the "find and replace" field, I see
^|^|^|^|^|^|^|^|^|^|^|^|^|^|
Any suggestions? Thanks
Try doing a regular text find/change.
In the Find What field, type < FEFF > (but delete the spaces before and after those angle brackets – the Stack Overflow editor seems to delete this if there are no spaces).
In the Change To, leave blank, and click change all.

Notepad++ convert leading spaces to tabs upon entry

Very close to reverse of this question. I prefer coding with 2-whitespace indentation, but need to have files indented with tabs to align with project convention. What I would like to do is preferably automatically convert 2 spaces upon entry to tab symbol in Notepad++ and have the editor configured to tab length of 2.
A possible manual way for doing this could be Edit->Blank Operations->Space to TAB but this converts all of my spaces to tabs, even those of length 1 - which are, for example, spaces between function arguments, not just leading spaces.
In a perfect case scenario I'm trying to achieve formatting style as described in this question, but with typing just spaces and the editor taking care of the rest.
I'm on Notepad++ 6.0, but willing to upgrade if this helps
Let me complete the answer of Ari Okkonen to add a workaround to the problem commented by Sergii Zaskaleta of mixed tabs and spaces at the beginning of the line.
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)
Select a block of lines of text with the problem of mixed spaces and tabs. Press [Tab] and [Shift]+[Tab] to add and remove a tab from each line. In the process, the leading spaces had been converted to tabs.
A manual way that seems to work: After having edited the file before saving you may try (Works in Notepad++ v6.8.3):
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)

Remove all lines containing a specific string

I have a big file and I want to remove all the lines that have the word date
For example:
{
date: 10291992
stuff: stuff
...
},
{
date: 02171995
stuff: stuff
...
},
...
So I want to remove all the lines that contains the word date but since each date has a different date, I can't just ctrl f and replace it. I was reading that putting ^.* in the front but it didn't work for me.
I'm currently using Sublime Text 3.
Thanks.
All you need to do is open the Find dialog (Find -> Find...), search for date, hit Find All to select all instances of your search pattern, then select Selection -> Expand Selection to Line. Hit Delete and you're all done.
I tried to follow the accepted answer but found it wasn't working for me: the Expand Selection to Line button was not expanding the selection for all the matched lines.
What did work, though, was to switch to regular expression mode (the *. button on the left of the Find menu) and do a search for
\n.+date.+
replacing it with an empty string. This removes the entire line (i.e., doesn't leave an empty line in its place).
Or faster: highlight date, hit Alt+F3 to Quick Find All, then Ctrl+X twice to delete the line.

How to delete line break in textmate

How to find and delete all the line breaks? I tried \n and it doesn't work! Regular expression? what kinda of expression?
I found the answer in the TextMate IRC channel.
Press Option Return to search for literal line breaks in the Find and Replace panel.
Searching for \n works if you select the "Regular Expression" option, but won't work in the literal search mode.
Without regex (regular search):
Alt + ⏎
Select the empty space in between the lines and Copy. Then Select the block of text you want to remove line breaks from. Go to Find & Replace. Paste the copied empty space in the Find field. Type a space in the Replace field. Hold Option, which toggles Replace All to In Selection, then click In Selection. This should do the trick.

Resources