Hi,

On Thu, Nov 03, 2011 at 04:12:29PM +0900, Jun Furuse wrote:
> I want to have pcre regexp literals in the same syntax as Perl i.e.
> /hello\sworld\\n/. Currently what we do in OCaml is Pcre.regexp
> "hello\\sworld\\\\n", where the backslash char must be escaped in a
> OCaml string literal. This is lousy for scripting in OCaml.

Have you look at camlp4 quotations ? Basically you can define a new
quotation named "foo" and in you code you can write:

  <:foo<...>>

The ... can be any string, except that it cannot contains >>.

Also you may be interested in the Mikmatch syntax extension:

  http://martin.jambon.free.fr/micmatch.html

Cheers,

-- 
Jérémie

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to