Add RegExp function for Replace Rule

Support "g" and "i" flag

For example:

Replace
/^http:\/\/([^\.]+\.)?abcd\.com/
With
http://www.1234.com
Will replace http://www.abcd.com, http://abc.abcd.com, http://abcd.com with http://www.1234.com

Replace
/\w{4}-(efgh)/
With
1234$1
Will replace abc.com/abcd-efgh, abc.com/aaaa-efgh with abc.com/1234efgh

Glitch:
All occurrences of the matching string will get replaced even if "g" flag is not specified.
Syntax fix and bug fix for undefined value

Add missing semi-colon.
Move vars to top of function.
Assign '' to pair.from if it is undefined.
Merge pull request #29 from Xelio/master

Add RegExp function for Replace Rule