cfRegeX


Regex Concepts

When dealing with regex, what people generally bring to mind is a seemingly arcane string of characters and, whilst this regex pattern is a key part of regex, it is just a part of it.

The pattern is a series of instructions to the regex engine on how to match whatever it has been created to match. However, the regex engine is also subject to a series of modes which alter the way certain regex instructions are interpreted, and it is important to understand what these modes do, and know when you need to enable or disable them.

The pattern and modes are combined to build the regex object, which can then be executed against a particular input text to identify positions where the pattern matches, but they only dictate what is matched, but not how this occurs.

The mechanics of how patterns are applied can get complicated, and developing a working knowledge of all the factors involved is not a trivial task, however it is important to understand at least the basics, in order to craft expressions correctly, and to avoid mistakes which can lead to bad performance. Fortunately there are a handful of rules which are pretty simple to learn, and it is well worth doing so.

By understanding these concepts of what a regex engine is being instructed to do and how it executes these instructions you will significantly improve your regex skills.