In the following code, if the string s is appended to be something like 10 or 20 thousand characters, the Mathematica kernel seg faults.
s = \"This is the fi
Mathematica uses PCRE syntax, so it does have the /s aka DOTALL aka Singleline modifier, you just prepend the (?s) modifier before the part of the expression in which you want it to apply.
See the RegularExpression documentation here: (expand the section labeled "More Information")
http://reference.wolfram.com/mathematica/ref/RegularExpression.html
The following set options for all regular expression elements that follow them:
(?i)treat uppercase and lowercase as equivalent (ignore case)
(?m)make ^ and $ match start and end of lines (multiline mode)
(?s)allow . to match newline
(?-c)unset options
This modified input doesn't crash Mathematica 7.0.1 for me (the original did), using a string that is 15,000 characters long, producing the same output as your expression:
s = StringReplace[s,RegularExpression@".*MAGIC_STRING(?s).*"->""]
It should also be a bit faster for the reasons @AlanMoore explained