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");
DiskEdit
clojure
(.replaceAll (re-matcher #"se\w+" "She sells sea shells") "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, clojure, or fsharp
There are 11 other solutions in additional languages (csharp, erlang, fantom, groovy ...)