Sublime Forum

How to Run a Command for RegReplace?

#1

I cannot figure out how to get RegReplace (plug-in) to run a find-and-replace program, and I believe it has to do with my lack of familiarity with how to perform this operation rather than anything wrong with RegReplace.

Steps so far: I have installed RegReplace using Package Control, written a short sample find-and-replace program (see below), and saved it in a document in what I believe is the proper location on my Mac: Application Support > Sublime Text > Packages > regex > User > “reg_replace_rules.sublime-settings”. I have also created what I believe is the correct command (code below) here: Application Support > Sublime Text > Packages > regex > User > “Default.sublime-commands”.

My understanding is that I should be able to call up the command in the Command Palette or by going to Sublime Text > Preferences > Package Settings > RegReplace > Commands - User. But no luck yet. Any help would be much appreciated.

About me: I am a new Sublime Text user and not a programmer/developer in any way (I’m a professor), and I’m trying to use Sublime Text to manipulate text, prepare text for publication on our work website in html.

Information about RegReplace is available here: https://facelessuser.github.io/RegReplace/.

Program

/*
    ###### Regex with optional scope qualifiers. ######
    - find (required)
    - replace
    - literal
    - literal_ignorecase
    - greedy
    - scope_filter
    - format_replace
    - selection_inputs
    - plugin
    - args
    */

{
	"replacements": {
		"fix_apostrophe": {
			"find": "’s",
			"replace": "’s",
			"greedy": true,
			"case": false
		},
	},
}

Command

    {
        "caption": "Fix_Apostrophe",
        "command": "reg_replace",
        "args": {"replacements": ["Fix_Apostrophe"], "find_only": true}
    },
0 Likes

#2

The best way to get an answer is to create an issue over at https://github.com/facelessuser/RegReplace/.

A similar question was asked before where I gave step by steps: https://github.com/facelessuser/RegReplace/issues/97.

If reading over that issue isn’t helpful, please create an issue over at the repo, and I can go over this with you when I get a bit of time.

1 Like