package mcp-kit
Source file regex.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16(** Regex engine - ECMAScript backend. JSON Schema patterns use ECMAScript regular-expression syntax and are not implicitly anchored. Keep the backend behind this module boundary so validation keywords do not depend on engine-specific APIs. *) type t = Ecma_regex.t let json_schema_flags = Ecma_regex.flags ~unicode:true () let compile pattern = match Ecma_regex.compile ~flags:json_schema_flags pattern with | Ok re -> Ok re | Error msg -> Error ("invalid regex: " ^ pattern ^ ": " ^ msg) let matches re s = Ecma_regex.search re s