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"
DiskEdit
python
transformed = re.sub(r'se\w+', 'X', 'She sells sea shells')
ExpandDiskEdit
fsharp
let replaced = ((new Regex("se\\w+")).Replace("She sells sea shells", "X"))
printfn "%s" replaced
ExpandDiskEdit
fantom
replaced := Regex<|se\w+|>.split("She sells sea shells").join("X")
ExpandDiskEdit
groovy
replaced = text.replaceAll(/se\w+/,"X")

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