Shameless plug - I wrote a plugin ages ago which makes it possible to replace and sort text using Python code (https://nneonneo.github.io/sublime-replace-with-python/). This little plugin has been incredibly useful for certain tasks, and serves both as a useful prototyping tool (playing with text modifications before implementing a full-blown script) as well as a general-purpose text wrangling utility. Basically, you can select some text (or find it with regex), then activate the plugin and type a line of Python code; it will then run the code for each selection region and produce the replacement. Sorting works similarly - select some regions, enter an expression as a sort key, and the selections will be rearranged according to the key.
I love how a plugin I wrote nearly a decade ago is still working with essentially no changes needed since 2017. Stable software is reliable software!