From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 8E5C47EE48 for ; Fri, 20 Feb 2015 20:29:04 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of milanst@gmail.com) identity=pra; client-ip=209.85.223.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of milanst@gmail.com designates 209.85.223.177 as permitted sender) identity=mailfrom; client-ip=209.85.223.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f177.google.com) identity=helo; client-ip=209.85.223.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="postmaster@mail-ie0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CDAQDUiudUlLHfVdFbhDaDBMZ1B0MBAQEBAQEQAQEBAQcLCwkSMIQoEQQZARseAxIQDwImAiQBEQEFARYMNYd4AQMRrC2DKz4xiy6Ba4J3jVsKGScNVIR3AQUOgRORS4FDBYpHgxeLM5FnEiOBDAmCIR+BbiAxgkMBAQE X-IPAS-Result: A0CDAQDUiudUlLHfVdFbhDaDBMZ1B0MBAQEBAQEQAQEBAQcLCwkSMIQoEQQZARseAxIQDwImAiQBEQEFARYMNYd4AQMRrC2DKz4xiy6Ba4J3jVsKGScNVIR3AQUOgRORS4FDBYpHgxeLM5FnEiOBDAmCIR+BbiAxgkMBAQE X-IronPort-AV: E=Sophos;i="5.09,616,1418079600"; d="scan'208";a="122734556" Received: from mail-ie0-f177.google.com ([209.85.223.177]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Feb 2015 20:28:44 +0100 Received: by iecat20 with SMTP id at20so10243249iec.12 for ; Fri, 20 Feb 2015 11:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=UVNR8+5n0AI6iqBpyk8ipaHpOVS9kVn0r26ADDRFU3o=; b=lwWZfdFJazXP8NsROqer3uRUDBm9CxDCjlyYky+XI8Lx0olgCsPwGBvx3LYgW4u4Ut WczdpC3pslz+eFKKbq2GawUhE5ECLycqPtYpay33SRXe2yDtTbXsE0hHx9JohdCaxmVx HEC/3YLxzkSf4gUaw3PNiuZa1V2J0pEt/D6MqakyXC2BYRaDE93JI4kAhT+vvodTVDWx MfyJ+X1haw6UfR0NfZ0BCnmWKSKjdBuQk6Omf4+lVeFAK6pxY8InM/38CjDJZEg2FAPn F8YeptHhCxoSUwqeHrZ52NOvSnM68q7YCN40TvDdhCguKzRfzzZbRslCb2sFD/xxP24/ Ghig== X-Received: by 10.42.210.20 with SMTP id gi20mr92989icb.34.1424460523044; Fri, 20 Feb 2015 11:28:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.168.5 with HTTP; Fri, 20 Feb 2015 11:28:02 -0800 (PST) From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Date: Fri, 20 Feb 2015 14:28:02 -0500 Message-ID: To: Caml List Content-Type: text/plain; charset=UTF-8 Subject: [Caml-list] scanf question I want to parse a bash like sequence string, for example "some-thing{1..20}", and extract the string before first { and then two numbers inside. I tried this first utop # Scanf.sscanf "some-thing{1..3}" "%s{%d..%d}" (fun s n1 n2 -> s,n1,n2);; Exception: End_of_file. Then I realized %s is special and needs scanning indication (character @). So I tried that but I get the same error utop # Scanf.sscanf "some-thing{1..3}" "%s@{%d..%d}" (fun s n1 n2 -> s,n1,n2);; Exception: End_of_file. But if I use some other character as end of string indication then it works. utop # Scanf.sscanf "some-thingI{1..3}" "%s@I{%d..%d}" (fun s n1 n2 -> s,n1,n2);; - : bytes * int * int = ("some-thing", 1, 3) It seems '{' is somehow special but I can't find anything in the docs about this. Can someone explain what is going on here? Thanks! p.s. At the end I solved my thing by using a range utop # Scanf.sscanf "some-thing{1..3}" "%[a-z-]{%d..%d}" (fun s n1 n2 -> s,n1,n2);; - : bytes * int * int = ("some-thing", 1, 3)