# Command that fills find and replace fields

#1

Hi, I’ve got a lot of small regex expressions in a file I use to convert various latex math equation environments and such. I’d like to make a plugin where I can search through them in the command palette and fill the “find” and “replace” fields in the replace panel similar to the “slurp_find_string” and “slurp_replace_string”. An additional bonus would be if the “Regular Expression” option would enable itself on its own.

I think the most universal approach would be make a command that takes any two regex or strings and fills the fields. Then one could just make their own .sublime-commands file according to their needs and potentially assign a keybinding to them.

My plugin making skills are very rusty and I have bigger fish to fry at the moment but if some else was also interested in such plugin or could potentially help me with it a bit, I’d certainly bump it up in my list of priorities.

Just as an example, here are a few of the slurps.

MathSlurps:->$$$$
\$$\s*\n\s*(.*)\s*\n\s*\$$
\$\$\1\$\$

MathSlurps:$$$$->
^(\s*)\$\$\s*(.*)\s*\$\$
\1\$$\n\1\t\2\n\1\$$

MathSlurps:$$->math
\$\$\s*([^\$]*)\s*\$\$math\n$1\n

0 Likes

#2

Does this package do what you want ? https://packagecontrol.io/packages/RegReplace

0 Likes