let trim = let trim_re1 = Str.regexp "^[[:space:]]+" and trim_re2 = Str.regexp "[[:space:]]$" in fun s -> Str.global_replace trim_re2 "" (Str.global_replace trim_re1 "" s)