Definition
open System.Text.RegularExpressions
let regex = Regex("^\d{2,4}$")
let regex = Regex("^\w{2,4}$", RegexOptions.IgnoreCase)
Matching
let wordRegex = Regex(@"^hello$", RegexOptions.IgnoreCase)
let isHello text =
wordRegex.IsMatch(text)
let checkEmail email =
let regex = Regex(@"^[\w.-]+@[\w.-]+\.(com|ch)$")
match regex.IsMatch(email) with
| true -> "Valid"
| false -> "Invalid"