Adobe Brackets: how can I find/replace multiple lines? - search

is there a way to find multiple lines within a project e.g.
<li>ABC</li>
<li>LKJ</li>
and replace it with: e.g.
<li>...</li>
<li>ABC</li>
<li>...</li>
<li>...</li>
<li>LKJ</li>
?
Thank you!

Brackets has the ability to use regex commands. There's alittle button with [.*]next the search field . Click that to activate it. So to do what you want your search field would be something like:
(<li>ABC</li>)(<li>LKJ</li>)
And your replace would be:
<li>...</li>$1<li>...</li><li>...</li>$2

Find > Replace In Files
Choose files
Set search and replace text
Review changes
Replace
http://blog.brackets.io/2014/06/27/brackets-0-41-release-replace-across-files/

Brackets has more powerful shortcuts to help replace any matched string.
Ctrl + H can be used to Find and Replace Strings without Regex

Related

Find text that contains tilde character

When I use ctrl+F to find WLR2~LW~VBD_MPN, it does not show up.
Using a simple example, ctrl+F finds words like cwfwf and qwdqw.
WLR2~LW~VBD_MPN can be found on other software—including other Office products—such as Microsoft Word.
I tried ticking/unticking options like match case and match entire cell contents as well as also other options (within/search/lookin).
What can be done to find a word like WLR2~LW~VBD_MPN?
Further clarification: WLR2~LW~VBD_MPN is not created by any formulas.

Prevent automatic tab insertion or conversion of spaces to tabs

Google Docs has a "feature" that sometimes converts four spaces to one tab.
Copying and pasting text does not solve this problem, because the spaces in that text are converted to tabs automatically.
Is there a way to turn this off?
No way to turn of that I know of. So annoying.
You can work-around using normal copy-paste, then a search-and-replace.
Copy-Paste you content into the Google Doc
In a text-editor, enter a tab character then cut it to your clipboard
Back in Google Docs, highlight the content you wish to fix
Hit Ctrl + H to open Find and replace dialogue
Paste the tab character into the Find field
Insert 4 space characters into the Replace with field
Click Replace all
The approach that caused me the least headaches was to replace all spaces by another character (say underscore) in the original text, copy/paste it, then replace the underscore using find+replace. This was in Google slides.
i use cmd+shift+v (edit -> paste without formatting) to paste.
The spaces are not converted to tabs.
I did find one solution: there is a Chrome plugin called "Drive Notepad" which edits google drive files and has an option "Tabs: hard"

vim: highlight words in visual block mode

Below is a screenshot of me entering visual block mode and pressing "w" to select by word:
How can I select every word in the rows I have selected? Meaning I want the full word in the rows highlighted instead of it getting cut off as shown in the screenshot.
edit: What I want to be able to do is delete a column of words of varying length. In the example screenshot I want to delete the words between the tags, But it could be any column of words.
There are a bunch of plugins for multiple selection, look them up on vim.org.
But I must remind you that visually selecting text is more often than not an unnecessary step. Why don't you explain what you actually want to achieve instead of your failed attempts? Maybe there's a better way...
[edit]
:'<,'>norm dit
seems to be the simplest way to achieve your goal without selecting every word:
and :,+7norm dit would be even better because you don't select anything.
The highlight modes can only select blocks (by cursor, by line, or by rectangular block). You can use a plugin such as vim-multiple-cursors to do what you are trying to do.
The only place where Vim allows a non-rectangular, "jagged edge" visual selection is at the end of the lines, i.e. by extending the blockwise selection with $. Therefore, you'd need to (temporarily) get rid of the trailing </th> (or include it in the selection, but operate in such a way that they are kept intact).
You shouldn't need a selection to work with the text. For example, to delete the text inside the tags, you can use a substitution:
:%s#<th>\zs.*\ze</th>##
You can't. You can only select rectangular blocks in block select mode. Maybe a plugin solves this?

Find and replace help, to remove certain things from text

I have file which contain 18k lines of text which consists of links and rondom ID codes and looks like this:
"
http://arduino.cc/en/Main/ArduinoBoardNano
SC09661
http://arduino.cc/en/Main/ArduinoBoardUno
http://www.farnell.com/datasheets/1639172.pdf
SC09670
http://arduino.cc/en/Main/ArduinoBoardUno
SC09665
http://arduino.cc/en/Main/ArduinoEthernetShield
SC09662
http://arduino.cc/en/Main/ArduinoXbeeShield
CS23020
http://bcove.me/zypzpy2q
SC09147
http://cache.national.com/ds/LM/LM134.pdf
SC08546
http://cache.national.com/ds/LM/LM2574.pdf
SC08540
http://cache.national.com/ds/LM/LM2576.pdf
"
I need to remove from this text all those ID codes (SC08540,SC09662,...) and links which not ends with .pdf, I know its posible with Notepad++ and other programs, with Replace funkction, but I dont know how exacly should I do this. Maybe I could get help with this?
I have not found a way to do this in one go with Notepad++ but this should work:
Open the replace box (Search --> Replace...) and select Regular expression
Search for ^.*[^\.][^p][^d][^f]$
Make sure Replace with is empty
Replace All
Now you have a file with empty lines and the links you want. There are at least two ways to get rid of the empty lines:
Method 1: TextFX plugin
Select all text
TextFX --> TextFX Edit --> Delete blank lines
Method 2: Replace
Make sure the cursor is at the beginning of the document
Open the replace box (Search --> Replace...) and select Extended
Search for \n\r
Make sure Replace with is empty
Replace All

Search for selection in Vim

I use Vim and Vim plugins for Visual Studio when writing C++. Often, I find myself wanting to search for a string within a function, for example every call to object->public_member.memberfunc().
I know Vim offers a convenient way to search for a single word, by pressing * and #, and it can also search for typed strings using the ubiquitous slash / command. When trying to search for all the instances of a longer string like the one above, it takes a while to re-type after /.
Is there a way to search for the selection? For example, highlight with v, then copy with y, is there a way to paste after /? Is there an easier shortcut?
Check this Vim tip: Search for visually selected text
Or you can simply yank the selected text with y and go to search mode /, then you can paste the last yanked text with Ctrl+R 0
Answer
Yank the text you want to search for
q/p
Enter
Explanation
q/ works similarly to vanilla search / except you're in command mode so p actually does "paste" instead of typing the character p. So the above will copy the text you're searching for and paste it into a search.
For more details type :help q/
Use q / instead of just /. (Same with q :). Now you can VIM-edit through your command and search history! (Try Ctrl-N and Ctrl-P sometime).
I just learned (through the excellent book Practical Vim) that there is a plugin for that.
You can find the plugin on GitHub.
The plugin lets you search for a visual selection with * and #.
You can actually select text visually and press * and # to search for the next occurrence... It will work the same, the only caveat is that:
Whitespace in the selection matches any whitespace, when searching (searching for "hello world" will also find "hello" at the end of a line, with "world" at the start of the next line).
http://vim.wikia.com/wiki/Search_for_visually_selected_text
--> if you want to highlight a text occurrences in gvim
Select the text & copy
then ?paste the selected text (Note: This will not work for insert mode)

Resources