OCaml中的正则表达式

Jac*_*ack 21 regex linker ocaml module

我想用正则表达式 OCaml中,似乎Str模块提供这些功能.

所以我尝试了一个简单的程序:

open Str
let regx = regexp "."
Run Code Online (Sandbox Code Playgroud)

但它给了我以下错误

文件"lol.ml",第1行,字符0-1:错误:链接lol.cmo时出错:引用未定义的全局`Str'

好像模块不存在但如果我删除open Str它说这regexp是一个未绑定的值.

我不知道它是什么类型的问题,Str应该是一个标准模块(根据http://caml.inria.fr/pub/docs/old-311/libref/Str.html)所以我很无能为力.我认为唯一的想法是签名(mli)存在但实现(ml)不存在.

Objective Caml version 3.11.0按照ocaml工具运行.

任何人都可以帮我解决这个问题吗?提前致谢

sep*_*p2k 29

手册:

使用str库的程序必须按如下方式链接:

ocamlc other options str.cma other files
ocamlopt other options str.cmxa other files
Run Code Online (Sandbox Code Playgroud)


new*_*cct 20

或者你可以把

#load "str.cma";;
Run Code Online (Sandbox Code Playgroud)

如果你在翻译中这样做的话