This function searches the string for matches of the regular expression and replaces the
actual matches with the replace string. This is the same functionality as the =~s/ operator in Perl.
The function fills the dollar array the same way as the function match.
As you can see in this case the value of re::$(0) is the string that was matched by the last replace inside the string.