Sublime Forum

A macro to upper case all sql keywords

#1

hi, I want to make a macro that do such thing:

in my selected text, run a regex match, and upper case all those match.

so basicly I need sublime command like those:

1. set find panel's regex on
2. set find panel's in selection on
3. run the regex
4. select all matches
5. do ctrl+k+u

so , what’s the corresponding commands? where can I find those commands?

1 Like

Automatically set SQL keywords to upper case
#2

I ended up using something like this. It is far from complete and will interfere with table and column names with these keywords, but it might help someone!

((?<=^)|(?<= ))(select|insert|into|update|delete|as|from|where|values|set|left|right|(outer|inner)? join|on|in)((?= )|(?=;))
1 Like

#3

Did you try using keyword selector ?

Open your file and type the line below in console:
view.selection.add_all(view.find_by_selector('keyword'))

Close the console and all keywords must be highlighted (depend of ST syntax definition)

1 Like