Deleting Line of Text Using Xcode Find and Replace - xcode

I'm wondering if it's possible to search for a certain line of a text using Xcode's Find & Replace feature, and fully delete the line so not even blank space is left over. Is this possible and if so how?

Copy the line you want to delete, including the newline character at the end of the line by triple-clicking on it (the selection should go all the way to the far right side of the editor pane). Perform a find and replace; paste the line into the the top field, and leave the replace field blank. Click Replace All.

On the latest Xcode you can just insert line break in the search field. Click on magnifying glass icon -> insert pattern -> Line Break

Related

How to sort emails data using its color codes in emeditor

I have this little challenge.
I want to ask, how do i sort the emails using the color code (light green) as stated in this picture here
I have tried to remove the non emails by scrolling through, but i need a solution that can make it a one click through sorting.
I will appreciate your kind response.
Open the Replace dialog box and enter the following regex in the Find field:
^((.*#[^\.]*)|([^#]+))$\n
Change the radio button to Regular Expressions. This regex pattern finds any line without a dot after # or any line without a #. Note that you need the last line of the document to be empty as shown in line 7 of your document.
Since we are deleting those lines, the "Replace with" field is blank. Now click Replace All.

RichEdit20A line selection mode similar to Notepad

I'm trying to change the way RichEdit20A Windows control selects line so it's similar to how it works in Notepad.
By default, if I select a line (e.g. Shift-End), then all the characters and the end of line is selected:
Sample text
^^^^^^^^^^^^ <- this is the selection
In Notepad it selects just the text:
Sample text
^^^^^^^^^^^
As a result, pressing delete (or backspace) in RichEdit20A control removes the line while in Notepad it just removes the text and keeps the line empty.
Is there any simple way (other than handling selection on my own) to configure the RichEdit20A control to keep formatting but make the line selection to work like in Notepad?
I don't know such a setting to influence the RTF control. But pressing Shift+End is a key input that is possible to trap with a WM_KEYDOWN handler, when you subclass the control.
You can use EM_LINEINDEX with -1 to get the current line start index.
Now with this index you can use EM_LINELENGTH.
Get the current selection (EM_GESTEL) and now you are free to use EM_SETSEL with the values you like to extend it.

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 Add tab space to multilple line at the same time in any text editor

If you select a text you can add multiple tab spaces to the all lines simultaneously.
For that you must select the n lines of the code and press the key tab. If you want
remove the tab spaces should select the text and press shift+tab.
I was programming in my job and I accidentally discovered this in the IDE eclipse. I test the same process
in the Sublime Text and Geany and it works too.
Y suposse and pressume that works for the most of text editor
I can confirm the answer from kelgwiin for sublime text.
Depending on your platform you could also do the following in sublime text:
Linux: Hold shift and the right mouse button, then move the mouse up or down to make a column selection.
Windows + OS X: Simply hold down the mousewheel and move your mouse up and and down to select the columns.
Hope this helps!
On Geany you can create by using Alt+Shift+Mouse (Windows) or Ctrl-Shift-Mouse (*x) a multiline cursor or an rectange selection, where you can work on many lines at the same time. This is only working for lines 'in row' so you cannot choose line 9 and lines 12-16 and lines 23-44 to be edited at the same time.

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