Case sensitive Cmd+D in Sublime Text 2 - sublimetext2

In ST2 ⌘+D expands the selection to the next word, using case insensitive matching. Is it possible to match the word case sensitive?

If you select Case sensitive in Find dialog (⌘+F), it will be remembered for ⌘+D as well.

Related

Case convert in multiples html files

I want to find and convert to lower case the content of the firth tag p in multiples html files.
This is possible using regular expressions in sublime text? How can I make it?
thanks!
You can try \L in sublime text to convert letters to lower cases:
Find What: (<p.*?>)((.|\n)*?)(</p>)
Replace With: \1\L\2\4

Double click to select words connected with break

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

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++.

Sublime Text 2 - Find and Replace: "case-sensitive" vs "preserve case"?

In the Find/Replace dialog, what is the difference between the options "case-sensitive" and "preserve case"?
The Case sensitive option determines what will be matched. The Preserve case option determines if the matched text's case is preserved or not when replacing it with the replacement string.
Here's an example which should make this clear. Imagine you have this:
word
Word
If Case sensitive is not selected and you look for word, text from both lines will be selected. If it is selected, only the first, lowercase word will be matched.
Let's say we're using tapioca as the replacement string. If Preserve case is not selected (and Case sensitive isn't either), a Replace All would give you the following result:
tapioca
tapioca
With Preserve case enabled, it would instead become:
tapioca
Tapioca
i.e., the second Word's case would be preserved and "applied" to the replacement string.

Regex all uppercase with special characters

I have a regex '^[A0-Z9]+$' that works until it reaches strings with 'special' characters like a period or dash.
List:
UPPER
lower
UPPER lower
lower UPPER
TEST
test
UPPER2.2-1
UPPER2
Gives:
UPPER
TEST
UPPER2
How do I get the regex to ignore non-alphanumeric characters also so it includes UPPER2.2-1 also?
I have a link here to show it 'real-time': http://www.rubular.com/r/ev23M7G1O3
This is for MySQL REGEX
EDIT: I didn't specify I wanted all non-alphanumeric characters (including spaces), but with the help of others here it led me to this: '^[A-Z-0-9[:punct:][:space:]]+$' is there anything wrong with this?
Try
'^[A-Z0-9.-]+$'
You just need to add the special characters to the group, optionally escaping them.
Additionally if you choose not to escape the -, be aware that it should be placed at the start or the end of the grouping expression to avoid the chance that it may be interpreted as delimiting a range.
To your updated question, if you want all non-whitespace, try using a group such as:
^[^ ]+$
which will match everything except for a space.
If instead what you wanted is all non-whitespace and non-lowercase, you likely will want to use:
^[^ a-z]+$
The 'trick' used here is adding a caret symbol after the opening [ in the group expression. This indicates that we want the negation of the match.
Following the pattern, we can also apply this 'trick' to get everything but lowercase letters like this:
^[^a-z]+$
I'm not really sure which of the 3 above you want, but if nothing else, this ought to serve as a good example of what you can do with character classes.
I believe you are looking for (one?) uppercase-word match, where word is pretty much anything.
^[^a-z\s]+$
...or if you want to allow more words with spaces, then probably just
^[^a-z]+$
You just need to put in the . and -. In theory, you don't need to escape because they are inside the brackets, but I like to to remind myself to escape when I have to.
'^[A-Z0-9\.\-]+$'
Try regular expression as below:
'^[A0-Z0\\.\\-]+$'