View Problem

Replace all regex matches in a string with a static string

Transform "She sells sea shells" into "She X X shells" by replacing /se\w+/ with "X"
ExpandDiskEdit
ruby
replaced = text.gsub(/se\w+/,"X")
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ Replaced = (gcnew Regex("se\\w+"))->Replace("She sells sea shells", "X");
ExpandDiskEdit
cpp C++/CLI .NET 2.0
String^ Replaced = Regex::Replace("She sells sea shells", "se\\w+", "X");
ExpandDiskEdit
fsharp
let replaced = ((new Regex("se\\w+")).Replace("She sells sea shells", "X"))
printfn "%s" replaced

Submit a new solution for ruby, cpp, or fsharp
There are 12 other solutions in additional languages (clojure, csharp, erlang, fantom ...)