I have the following list:
select 'ABC','A101',1;
select 'PABC\CE','U101',2;
select 'A-BCXY','P01',3;
select 'UABZUE','PU101',4;
select 'WABCPY','IP1',5;
select 'R-YUABC','2U1',6;
select 'PYRABCQWDES','U1',7;
......
......
(900 lines)
I want to copy only first data which is in single quotes:
'ABC'
'PABC\CE'
'A-BCXY'
'UABZUE'
'WABCPY'
'R-YUABC'
'PYRABCQWDES'
I tried with Ctrl+D for select and cursor key to copy but unable to get complete string.
You need to use a regular expression. Sublime Text uses the Boost C++ Library Perl Syntax.
Open the find panel and make sure Regular Expression is selected and Whole Word is NOT selected. Paste the following regex into the panel and click on Find All. The first single quoted text following the word 'select' on every line will be selected throughout the document, the single quotes will also be selected.
(?<=select )'([^']*)'
The components of that regex are:
(?<=select ) A lookbehind to find the text: "select "
' Match a single quote (i.e. the beginning quote)
([^']*) Match any number of characters that are NOT a single quote
' Match a single quote (i.e. the ending quote)
This variation will do the same thing but without selecting the single quotes.
(?<=select ')([^']*)(?=')
Related
I am trying to change format of all REF fields surrounded by square brackets, such as "[{REF ... \h \t}]". My approach is to search and select all the target fields and then apply format change command, for example Highlight.
A attempt search "[\d" Word delivers selected only the left part of the field, but if I search "\d]" then Word finds nothing.
Is there a way to do such search via GUI or VBA?
Thank you.
In Sublime text editor, I have a text as below (taking notes for nodejs in markdown format)
In Nodejs, command-line arguments will be stored in the process object and in the process object there is a property called argv(argument vector) and arguments will be stored in the form of array
If I want to search all process words and add markdown back-ticks quotes(`) around them, How can I do this in sublime ?
If there are no places where the string "process" is in the middle of a word, such as "subprocess", I would do:
Press Ctrl+f to open search.
Enter process in the search field.
Press Alt+Enter to select all coincidences.
Edit accordingly.
If I wanted to check each coincidence to avoid adding the quote marks erroneously I would instead do:
Press Ctrl+h to open search and replace.
Enter process in the search field.
Enter `process` in the replace field.
Click Find to see the next coincidence.
Click Replace or Find as necessary.
The Excel file I am using has cells which contains multiple lines typed in by using Alt+Enter. When this Excel is load into teradata, these multiple lines in single cell should reflect in single cell in the teradata table also. But instead, it is getting loaded as several rows. How to rectify this?
Go to Find & Replace (aka Ctrl+H). Type Ctrl+J in the Find what: text box and put a space or some alternate character in the Replace with: text box. Make sure that the Match entire cell contents is not active and click Replace All.
This effectively changes all instances of line feeds (aka CHAR(10), vbLF or ASCII 0010) into spaces. If spaces will not suit your purposes, choose another character or text string.
I remember hearing about the option to search for an exact word in Sublime, but I can't seem to find it.
What I mean by this is if I search for write, I'd like to exclude all instances of foo_write, foowrite, etc.
How can this be done?
Hit CtrlF (Win/Lin) or CmdF (OS X) to open up the Find tab. Make sure the first button on the left (Regular Expressions) is selected. In the search field, enter \bfoo\b and click the Find button or hit CtrlG/CmdG to search. The \b token indicates a word boundary, including spaces, punctuation marks like commas, periods/full stops, question marks, etc.
Also, the third button from the left, a pair of double quotes, says 'Whole Word' when you hover - Click this to find the exact word.
E.g., if I search for 'stage' it will return the line that contains the text 'when the stage changes' but not the line that contains the text '= b.stage__c'
I'm doing the following to copy some text inside quotes and paste it in a different place (inside quotes as well):
di"
go-to-buffer-for-copy
copy-string (ex. yi")
then-go-to-prev-buffer
paste-to-string (p)
But I want to do it in a simpler way, like this:
yi"
go-to-buffer-for-paste
replace-inner-quotes-to-yanked-text
For "replace-inner-quotes-to-yanked-text" you can use vi"p.
(pulling my comment into its own answer)
Assuming you use vim with system clipboard, you could do the following:
"+yi" to copy the text inside quotes to your system clipboard
position your cursor inside the quotes where you want to put that text
ci"<Ctrl-V><Esc> replaces what's inside the quotes with the content of your clipboard
One benefit is that if you want to put the original text in multiple places, you can place your cursor in the next position and press ..
vi"p, proposed by Randy Morris, works but it replaces the content of your default register and the selection won't be captured in the "do again" command, only the paste.
You could still use the "0 register to access your original text but I haven't found a command that would change inside the quotes and paste in a way that redo maintains.
This technique enables you to stay out of insert mode and doesn't require mapping the unnamed clipboard to the system clipboard:
yi" (yank inside the quotes
?' followed by first few letters of current contents of target quotes (search back)
p (paste)
dt" (delete the pre-existing content that was in the quotes