Regular Expression
Rescript
- ReScript regular expressions compile cleanly to their JavaScript counterpart:
- Js.Re Doc
- Js.Re Source
let re = %re("/^ryan.*myat$/i") // starts with ryan .. ends with myat
Js.log(Js.Re.test_(re, "Ryanzanthumyat")) // true
OCaml
(* using Re package *)
let re = Re.Perl.re {|^ryan.*myat$|} |> Re.no_case |> Re.compile ;;
Re.execp re "RyanzanthumyaT" (* true *)