Explaining how a regexp parsing engine works is probably beyond the scope of an answer on such a forum, but since many programming languages are open source, you can look at their source code and how they parse regular expressions. For instance, here is a pointer for Python:
https://github.com/python/cpython/blob/master/Lib/re.py