Press CTRL+C or CMD+C to copy the selected text and close this dialog.
Tweet
4 people like it. Like the snippet!
Regex String and Int, e g : "qwe123" -> "qwe" and 123, "qwe" -> "qwe", 123 -> 123
1: 2: 3: 4: 5: 6: 7: 8: 9:
let IntAndString value = let (|Match|_|) pattern input = let m = Regex.Match(input, pattern) in if m.Success then Some ([ for g in m.Groups -> g.Value ]) else None match value with | Match @"((?>\d+))(\w+)" x -> Some(x) | Match @"((?>\d+))" x -> Some(x @ ["items"]) | Match @"(\w+)" x -> Some(x) | _ -> None