"Replace with Python" for Sublime Text
View the Project on GitHub nneonneo/sublime-replace-with-python
Sublime Text has a great regex-powered find-and-replace feature. But, what if you want to do a little more complex replacement? “Replace with Python” empowers your replace command with Python, letting you do advanced text manipulation intuitively and easily.
Compatible with Sublime Text 2, 3 and 4.

Find => Replace with Python (with_python_prompt_replace)
Find => Find... followed by alt+enter to select all matches.alt+enter), which uses the text and/or index variables and ultimately assigns the text variable.text variable replacing the selected text.Edit => Sort Lines with Python (with_python_prompt_sort_lines)
line and/or index variables. The result of this expression is used as a sort key.Edit => Sort Selections with Python (with_python_prompt_sort_selections)
text and/or index variables.text - Selected text. Usable in Replace With Python and Permute Selections => Sort With Python.line - Line within a selection. Usable in Permute Lines => Sort With Python.index - 0-based index of the current selection region. Usable in all functions.lineno - Line number within the current selection. Usable in Permute Lines => Sort With Python.