RegexMagic Examples

The best way to learn the ins and outs of RegexMagic is to work through as many examples as you have time for. All examples have full step-by-step instructions. You can do them in any order. The only prerequisite knowledge is given in the getting started topic. But your learning curve will be shallower if you do the examples in order.

RegexMagic Patterns

Any regular expression you build in RegexMagic will use one or more patterns. In fact, you have to use patterns for all the text that your regular expression should match. A pattern in RegexMagic is a description of a certain piece of text that RegexMagic can generate a regular expression for. Patterns can be simple, matching only certain characters, or quite complex, matching things such as entire email addresses or URLs.

Regular Expressions Generated from a Single Pattern

The simplest regular expression you can create in RegexMagic consists of just one field that uses one of these patterns. All the examples below create a regular expressing using one of the different patterns that RegexMagic provides. These examples are a good way to get started with RegexMagic. They make you familiar with the kinds of patterns that RegexMagic supports. These patterns are the building blocks for regular expressions that match text for which RegexMagic does not provide a ready-made pattern.

Special Patterns Used with Other Patterns

A few of RegexMagic’s patterns can only be used (sensibly) in a regular expression that consists of multiple fields. The following examples show each of those patterns.

Combining Multiple Patterns

Once you’re familiar with the way RegexMagic’s patterns work, you can move on to creating regular expressions that use multiple fields to combine different patterns together. This way you can create regular expressions that match pretty much anything you want (within the capabilities of the regular expression syntax).

Action Examples

On the Action panel, you can tell RegexMagic that you want to extract part of the text matched by the regular expression, or to use the regular expression in a search-and-replace.

Real World Examples

The above examples are all engineered to demonstrate RegexMagic’s capabilities in a piecemeal fashion, so you can learn RegexMagic by using it. The examples below put everything together to create regular expressions to solve actual problems, as you will do when using RegexMagic day to day.