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")
DiskEdit
csharp
using System.Text.RegularExpressions;

class SolutionXX
{
static void Main()
{
string text = "She sells sea shells";
string result = Regex.Replace(text, @"se\w+", "X");
}
}
ExpandDiskEdit
fantom
replaced := Regex<|se\w+|>.split("She sells sea shells").join("X")

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