Login
|
Signup
langref.org
-
python
,
csharp
, and
clojure
add..
all
cpp
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Regex
Replacing
Replace the first regex match in a string with a static string
Transform
"Red Green Blue"
into
"R*d Green Blue"
by replacing
/e/
with
"*"
python
print re.sub(r'e', '*', 'Red Green Blue', 1)
print re.sub(r'e', '*', 'Red Green Blue', 1)
clojure
(.replaceFirst (re-matcher #"e" "Red Green Blue") "*")
(.replaceFirst (re-matcher #"e" "Red Green Blue") "*")
Submit a new solution for
python
,
csharp
, or
clojure
There are 13 other solutions in
additional
languages (
cpp
,
erlang
,
fantom
,
fsharp
...)