Added a $limit option to find_replace_templatesets

Some plugins need to set a limitation on the number of possible replacements in a template, imagine you want to add a script right after some "</script>", and your template contains two or more "</script>", if you don't specify a limitation, you will get your string inserted twice. A more serious issue happened to me when I tried to replace a whole template (using /.*/s), the replacement got inserted twice, because preg_replace considered even the empty string as a match, I replaced it with /.+/s (one character at least) as a workaround, but it's still not what I should do, because I DO want to allow empty templates to be replaced too, along the non-empty templates to be replaced also, but I want to limit that to ONE remplacement only.
Merge pull request #1384 from medbenji/feature

Fixes #1488 Add a $limit option to find_replace_templatesets