I haven't really bothered refactoring it (although I'm not sure it's possible to get it any smaller) and it does rely on jQuery (if only to make my life a tiny bit easier, it would still work without with minor changes!).
Right! There's 4 files.
-
str_replace.js: This is the function without any blank lines or comments.
-
str_replace_cleaner.js: Same as above with blank lines and comments.
-
str_replace_prototype: Same as above but it modifies the strings prototype so you can call the function the same way you'd call .replace()
-
str_replace.php The same challenge in PHP.
Pretty fucking nifty huh?