Test Ocaml Lexer Regex
change the regex pattern and run make. test.exe will output the matchs in data.txt
{
open Lexing
}
let regex = ['0'-'9']+ (* <--- change the regex here)
rule read = parse
| regex { Lexing.lexeme lexbuf |> print_endline; read lexbuf }
| _ { read lexbuf }
| eof { () }
โ test_regex_in_ocaml_lexer git:(master) make
jbuilder build test.exe
./_build/default/test.exe data.txt
123
5
6
4