Before we move further to start creating advanced regular expressions, I want to quickly explain how a regular expression works.
These are just pattern definitions using the literal notation. What actually "applies" these pattern definitions on strings to get matches is a REGEX ENGINE.
So your programming languages like JavaScript, Python, PHP—they all have these regex engines for executing regular expressions.
In this course, we're going to focus on Backtracking regex engines as that is what is most common in programming languages.
When you apply a regular expression to a string, the engine does a search through the string from left to right. What happens is that, it starts searching from the beginning, until it encounters the first token, or you can say first character in the string that matches the first character in your pattern.
The engine starts searching the string to find a “c”, since that is what begins the pattern. It finds a “c” at position 7 (counting from 0). It considers this a potential match. The engine keeps record of position 7 as its start: