You need some background to understand regular expression parsing. I would suggest writing your own simple parser. For example, you could write a parser which evaluates mathematical expressions like
(3+4)*5
or
17*5+3/6-3^(4-5)
Then add variable substitution
a=10
b=a*3+4
Then read any regular expression tutorial. It will make much more sense.