Double click to select words connected with break - sublimetext2

I am using Sublime Text 2 and when I double click on word connected with underline like:
this_is_it
it will auto select whole phrase, but when is words connected with break symbol like this:
this-is-it
it will select only one of words, how can I set Sublime Text to select whole phrase?

Modify "word_separators" in user's Preferences.sublime-settings, the default is:
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?"
Since - is minus in most programming language, it is included as default separator. You better modify syntax specific files (e.g. Plain text.sublime-settings) to suit your need.
http://compscientist.com/post/28272180856/word-separators

Related

Replace text next to static text google script

I would like to replace the text in a google doc. At the moment I have place markers as follows
Invoice ##invoiceNumber##
I replace the invoice number with
body.replaceText('##invoiceNumber##',invoiceNumber);
Which is fine but I can only run the script once as obviously ##invoiceNumber## is no longer in the document. I was thinking I could replace the text after Invoice as this will stay the same, appendParagraph looks like it might to the trick but I can't figure it out. I think something like body.appendParagraph("Invoice") would select the area? Not sure how to append to this after that.
You could try something like this I think:
body.replaceText('InvoiceNumber \\w{1,9} ','InvoiceNumber ' + invoicenumber);
I don't know how big your invoice numbers are but that will except from 1 to 9 word characters preceeded by a space and followed by a space. That pattern might have to be modified depending upon your textual needs.
Word Characters [A-Za-z0-9_]
If your invoice numbers are unique enough perhaps you could just replace them.
Reference
Regular Expression Syntax
Note: the regex pattern is passed as a string rather than a regular expression

Select text wrapped in quotation marks

Is it possible to select text wrapped in quotation marks or other signs in PhpStorm (2016)?
I.e.
"Here is some code"
When I use shortcut I want to select all what is in quotation marks.
This depends on context -- what language it is. It works fine for PHP & JavaScript but does not do anything special in HTML (as " are treated as part of the actual text).
Place caret inside such string
Use Edit | Extend Selection (Ctrl + W on Windows/Linux using Default keymap; on Mac it most likely will be Alt + Arrow Up or similar)
You will need to use that shortcut few times in a row (at least 2 times if there are more than one word in a string) until it selects whole string content as this shortcut works in incremental mode -- first current word, then sentence or other outer code construction and so on.

right side alt shift in sql

How does one append all lines in a SQL query with text?
In order to add something to the front of my lines of code I can use Alt+Shift down the left side and type something to change
example-1
example-12
example-123
example-1234
example-12345
to
a.example-1
a.example-12
a.example-123
a.example-1234
a.example-12345
but if I want to add something to the right side, it turns out like this
a.example-1*
a.example-1*
a.example-1*3
a.example-1*34
a.example-1*345
when i want it to look like this
a.example-1*
a.example-12*
a.example-123*
a.example-1234*
a.example-12345*
So, how do I do this? Is it possible to append all lines with something with Alt+Shift or is there another method?
*Edit example
To clarify, I need to edit the text in my SQL code, not the text within my tables and such. Ex.:
SELECT TOP 1000
[day]
,[workout_name]
,[reps]
FROM [tom].[dbo].[workout_routine]
but instead of having the commas at the beginning of [day], [workout_name], let's say I need them at the end, like:
SELECT TOP 1000
[day],
[workout_name],
[reps]
FROM [tom].[dbo].[workout_routine]
Because Alt+Shift works and aligns at any column of text, but I need to know if there is a way to be able to add something to the end of lines of differing lengths.
There is a Concat function in mysql.
Select concat(row, ' text after row') from table
If you're looking to modify a script, you can use Regex to replace $ which represents the end of line character. So if you were in Notepad++, you can do a find and replace for $. Make sure you allow Regular expression in the search mode.

Remove/strip specific Html tag and replace using NotePad++

Here is my text:
<h3>#6</h2>
Is he eating a lemon?
</div>
I have a few of them in my articles the #number is always different also the text is always different.
I want to make this out of it:
<h3>#6 Is he eating a lemon?</h3>
I tried it via regex in notepad++ but I am still very new to this:
My Search:
<h3>.*?</h2>\r\n.*?\r\n\r\n</div>
Also see here.
Now it is always selecting the the right part of the text.
How does my replace command need to look like now to get an output like above?
You should modify your original regex to capture the text you want in groups, like this:
<h3>(.*?)</h2>\r\n(.*?)\r\n\r\n</div>
( ) ( )
// ^ ^ These are your capture groups
You can then access these groups with the \1 and \2 tokens respectively.
So your replace pattern would look like:
<h3>\1 \2</h3>
Your search could be <h3>(.*)<\/h2>\r\n(.*)\r\n\r\n<\/div>
and the replace is <h3>$1 $2</h3>, where $1 and $2 represent the strings captured in the parentheses.

Insert same code around different filenames

I am making a small online database that is accessible through the form of checkboxes for download. I was wondering if there was some way to list all of the filenames available for download in Sublime Text 2 and insert the same code around each filename?
Everything is functional, it would just save me a lot of repetitive copy and pasting if there is a faster way to do this.
Use SublimeText Find & Replace. Click the Regex button (it looks like a * to the left of the search box)
In the Find box, insert: (^.*$)
In the replace box: [yourcode]$1[yourcode]
Where [yourcode] is what you want to insert into the box.
So, if you want to make them all <li> then your replace box would be:
<li>$1</li>
Remember to use escape \ characters where they are needed, in case you need to insert restricted characters.
^ - beginning of a new line.
. - wildcard
* - any number of the previous character in the sequence (in this case a wildcard, so any text)
$ - the end of a line
() - denotes a block, it's how the $1 knows what text to put in it's place.
Sublime Text Search and Replace
Use search/replace on a text editor with regular expressions.
^ and $ represent the beginning and end of a line - thus allowing you to easily surround each line with the appropriate text.
Sometimes you can copy the newline character (as in copy the end of one line to the beginning of the next line), and replace that with whatever text you need.
You could always use the regular expression search / replace feature in Notepad++.