Integrating RegexMagic with your favorite tools can significantly speed up this workflow by automating most of the steps. The simplest form of integration is by starting RegexMagic with certain command line parameters. This method is appropriate when you want to integrate RegexMagic with a 3rd party tool. If the tool has the ability to run external applications, you can easily launch RegexMagic from within the tool.
RegexMagic’s command line parameters are case insensitive. The order in which they appear is irrelevant, except for parameters that must be followed by a second “data” parameter. The second parameter must immediately follow the first parameter, separated with a space. Values with spaces in them must be delimited by a pair of double quotes. Parameters can start with a hyphen or a forward slash.
RegexMagic will show the Send To button. When clicked, the regex is copied to the clipboard. The regex is copied “as is”, unless you specify one of the format options.
Specify the application that the generated regular expression should work with. The app value must be an application identifier. RegexMagic will use this application’s string style, regex flavor, replacement flavor, split flavor, and source code template. If there is no application identifier for the combination of string style and flavors that you want, then you cannot use the -app parameter. You can use the separate -string and -flavor parameters to specify custom combinations.
Tell RegexMagic to use a certain string format for -putonclipboard. The stringstyle value must be a string style identifier. If you use both -app and -string, then -string takes precedence.
Specify the regular expression flavor that the generated regex should work with. The flavor value must be a valid regex flavor identifier. If you use both -app and -flavor, then -flavor takes precedence.
Specify the replacement text flavor you’re working with. The flavor value must be a valid replacement flavor identifier. If you use both -app and -flavorreplace, then -flavorreplace takes precedence. -flavorreplace is ignored unless you also use -app or -flavor to set the regex flavor.
Specify the split flavor you’re working with. The flavor value must be a valid split flavor identifier. If you use both -app and -flavorsplit, then -flavorsplit takes precedence. -flavorsplit is ignored unless you also use -app or -flavor to set the regex flavor.
Select the RegexBuddy source code template for the Use panel. You can specify the file name of the template without the path and without the extension. If you use both -app and -template, then -template takes precedence.
Specify a string to use as a delimiter so that more text than just the regular expression can be passed via the clipboard. Your chosen delimiter must not be something that will appear in the regex or replacement text generated by RegexMagic. Something like ?**?**? that isn’t valid regex syntax is a good choice.
If you do not use the -delimitclipboard parameter, then only the regular expression is copied to the clipboard when you click the Send button.
If you use -delimitclipboard then RegexMagic copies the regular expression followed by the delimiter followed by the list of options. No line breaks or whitespace are added around the delimiter. The regular expression is still formatted using the string style specified by the -app or -string parameter. The list of options is a comma-delimited list of options that need to be turned on. Options that need to be turned off are omitted.
|dotall||Dot matches line breaks|
|multiline||^ and $ match at line breaks|
|lblfonly||LF only line break mode|
|lbcronly||CR only line break mode|
|lbcrlfonly||CRLF pairs only line break mode|
|lbcrlf||CR, LF, or CRLF line break mode|
|lbunicode||Unicode line break mode|
|explicitcapture||Parentheses do not create numbered groups|
|namedduplicate||Named capturing groups can have the same name|
|ungreedy||Quantifiers are lazy and appending ? makes them greedy|
|skipzerolength||Skip zero-length matches|
|stringsyntax||Support literal string escapes on top of the regex or replacement text syntax|
|splitlimit1234||Split action with 1234 as the limit; 1234 can be any positive or negative integer; omit 1234 to split without a limit|
|splitcapture||Add capturing groups to the resulting array when splitting a string|
|splitempty||Add empty strings to the resulting array when splitting a string|
If a replacement text is generated, the options are followed by another delimiter and the replacement text. The replacement text is also formatted using the string style specified by the -app or -string parameter.
Start with a blank RegexMagic Formula and paste the text on the clipboard as a sample on the Samples panel. The text on the clipboard is always used “as is”.
-appname "Application Name"
The -appname parameter must be immediately followed with a parameter that indicates the name of the application that is invoking RegexMagic. RegexMagic will show this name in its caption bar, to make it clear which application the Regex will be sent to. You should always specify -appname when using -putonclipboard.
Loads the specified RegexMagic Formula file. Use this parameter if you want to associate RegexMagic with rmf files. This file format is used to share individual RegexMagic Formulas on the RegexMagic user forum.
Loads the file as a sample on the Samples tab.
Opens the specified library on the Library tab. Use this parameter if you want to associate RegexMagic with rml files.
Opens the specified GREP action on the GREP tab. Use this parameter if you want to associate RegexMagic with rmg files.
Use this parameter in combination with -putonclipboard. -activate must be followed by a decimal unsigned integer that indicates the window handle of the active top-level form in your application. When the Send To button is clicked, RegexMagic will use the SetForeground() Win32 API call to bring your application to the front. That way, the Sent To button enables you to continue working with that application right away.