Regular expressions: Difference between revisions

Content added Content deleted
m (→‎{{header|Raven}}: Add extra replace options, and add splitting example)
(Added F# version)
Line 463: Line 463:
NewString = re:replace(String, " a ", " another ", [{return, list}]),
NewString = re:replace(String, " a ", " another ", [{return, list}]),
io:format("~s~n",[NewString]).</lang>
io:format("~s~n",[NewString]).</lang>


=={{header|F_Sharp|F#}}==
{{trans|C#}}
<lang fsharp>open System
open System.Text.RegularExpressions

[<EntryPoint>]
let main argv =
let str = "I am a string"
if Regex("string$").IsMatch(str) then Console.WriteLine("Ends with string.")
let rstr = Regex(" a ").Replace(str, " another ")
Console.WriteLine(rstr)
0</lang>


=={{header|Forth}}==
=={{header|Forth}}==