Using RegexMagic with RegexBuddy

RegexMagic is another product from Just Great Software. Just like RegexBuddy, it is designed to make it easy to create regular expressions. The key difference is that with RegexBuddy, you work directly with the regular expression syntax, or plain English building blocks that correspond directly with the regex syntax. With RegexMagic, you don’t deal with the regular expression syntax at all. Instead you use RegexMagic’s powerful patterns for matching characters, numbers, dates, times, email addresses, and much more to specify what you want, and RegexMagic generates the regular expression for you.

Suppose you want to match a number between 256 and 512. In RegexMagic, you simply select the “integer” pattern. In the pattern’s properties, you set the minimum and maximum values to 256 and 512. RegexMagic automatically generates the regular expression 51[0-2]|50[0-9]|[34][0-9]{2}|2[6-9][0-9]|25[6-9]. This regex, though conceptually simple, would be quite a chore to create by hand, even for regular expression experts.

If you own both RegexBuddy and RegexMagic, you can use the RegexMagic button on the Create panel in RegexBuddy to generate (part of) your regular expression with RegexMagic. The generated regex is automatically transferred to RegexBuddy so you can further edit and test it. The RegexMagic button offers three choices.

Click the Generate New Regex item under the RegexMagic button on the Create panel to launch RegexMagic. The Samples panel will have one sample with the text from the Test panel in RegexBuddy. The Match and Action panels will be blank. When you click the Send button on the Regex panel in RegexMagic, the regular expression in RegexBuddy, if any, will be replaced with the one you generated in RegexMagic. Nothing will happen if you close RegexMagic without clicking the Send button.

Click the Regenerate Regex item to launch RegexMagic with the same settings on the Samples, Match, and Action panels as you had them when you last clicked the Send button in RegexMagic after choosing Generate New Regex or Regenerate Regex in RegexBuddy. RegexMagic will not take over any changes you may have made to the previously generated regular expression in RegexBuddy. While you can edit any regular expression with RegexBuddy, RegexMagic can only edit regular expressions that it generated by itself, and for which you have saved the settings in a RegexMagic library. When you click the Send button in RegexMagic, the regular expression in RegexBuddy, if any, will be replaced with the one you generated in RegexMagic.

Click the Insert Regex item to launch RegexMagic. The first time you use this command, the Match and Action panels in RegexMagic will be blank. After that, the Match and Action panels will be as you left them last time you clicked the Send button in RegexMagic after choosing the Insert Regex command. When you click the Send button in RegexMagic, the regular expression generated by RegexMagic is inserted into the regular expression you have in RegexBuddy.

At the bottom of the Insert Token menu you’ll also see a RegexMagic item. This item works exactly the same as the Insert Regex item in the RegexMagic menu.