From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 27FF7BBAF for ; Mon, 6 Dec 2010 12:50:00 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsEAIRc/ExiizT6gGdsb2JhbACUbTGOKQEBCwsKBRMDH60rghmEJ4kEAQQEAYVEBIRfiSI X-IronPort-AV: E=Sophos;i="4.59,305,1288566000"; d="scan'208";a="82075962" Received: from nm30-vm0.bullet.mail.ac4.yahoo.com ([98.139.52.250]) by mail4-smtp-sop.national.inria.fr with SMTP; 06 Dec 2010 12:49:59 +0100 Received: from [98.139.52.189] by nm30.bullet.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 11:49:58 -0000 Received: from [98.139.52.150] by tm2.bullet.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 11:49:58 -0000 Received: from [127.0.0.1] by omp1033.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 11:49:58 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 12226.15059.bm@omp1033.mail.ac4.yahoo.com Received: (qmail 89153 invoked by uid 60001); 6 Dec 2010 11:43:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1291635797; bh=sWFnhGiBX7U83VkVIRk1ih79Dn8yWxkX2z82ZOqQe5w=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=helc84jaLIX+tvrb6zIF20kX0UIAqitp+tu9529cigRF4tZ8Hdla5+yUAKTwffLoAtkE4gscW3giADSUjAlBY41Q2FrYXfz1SC76IJWl3WMaVyBNW8Hk4TYTpuwLKkIjZUlkuecOri269TKc+LTh4bAs+8peXnfs+HxRaW7G2EI= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=i72HKIEUbvWZw7mMLgLHhHa5H0/10EfQLQhD34N7OEOZaxEGdIyLtxuh2pUTxIA0/ZKTnIwlmX3U1yeL2ejNyOS3krJa4nYF6JYdA9SGss4aaoCNxu6/gPJjaOMrGvzfIuk3P1fXmmZGS6VqlyYBk1rxQLHHM0hWtDfu0JQmfPA=; Message-ID: <926418.88102.qm@web65410.mail.ac4.yahoo.com> X-YMail-OSG: OtezTR0VM1kbyCAihDciegXXxNsbGv80Df7KdT5zFT6ke_T UhBcq9wAZlgiI20HOItsmUUPc6IG07LYtDqFJxMCPCbTT50vhtw8qmCX6mwE q7D0na3KaNPKUJEkDCRr1GZ31TxjVISXGa_DPfpXPWh4E9fSiIQCjQN5aj6z Ku0TJ5LwpNaz9d9jOJji14_CP3OPWKr9xt5qiKmsQNeh1AfG17jRtLLgnjWM 4Uiq.vgB4lzYGMKQ9NJoQzl1fjU1YLRjnTk310yAUL4_B8o6HkWaNZJ1Q3GU D2GUsd106pxxDNSPY81KcqS3IYVGJzYUokFiRmpYUugm4G3KML9Jd_1RHBXs tdneqrA-- Received: from [147.188.192.41] by web65410.mail.ac4.yahoo.com via HTTP; Mon, 06 Dec 2010 03:43:17 PST X-Mailer: YahooMailClassic/11.4.20 YahooMailWebService/0.8.107.285259 Date: Mon, 6 Dec 2010 03:43:17 -0800 (PST) From: zaid khalid Subject: help with regular expression To: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1446877188-1291635797=:88102" X-Spam: no; 0.00; ocaml:01 ocaml:01 syntax:01 regexp:01 syntax:01 regexp:01 aba:98 aba:98 matched:01 matched:01 strings:01 strings:01 expression:02 expression:02 string:02 --0-1446877188-1291635797=:88102 Content-Type: text/plain; charset=us-ascii Hi Folks I want some help in writing regular expressions in Ocaml, as I know how to write it in informal way but in Ocaml syntax I can not. For example I want to write "a* | (aba)* ". Another question if I want the string to be matched against the regular expression to be matched as whole string not as substring what symbol I need to attach to the substring, i.e if I want only concrete strings accepted (like (" ", a , aa , aaa, aba, abaaba), but not ab or not abaa). Hint I am using (Str.regexp) Thanks --0-1446877188-1291635797=:88102 Content-Type: text/html; charset=us-ascii
Hi Folks

I want some help in writing regular expressions in Ocaml, as I know how to write it in informal way but in Ocaml syntax I can not. For example I want to write "a* | (aba)* ".

Another question if I want the string to be matched against the regular expression to be matched as whole string not as substring what symbol I need to attach to the substring, i.e if I want only concrete strings accepted (like (" ", a , aa , aaa, aba, abaaba), but not ab or not abaa).


Hint I am using (Str.regexp)
Thanks


--0-1446877188-1291635797=:88102-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 351FDBBAF for ; Mon, 6 Dec 2010 13:07:03 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusBAPtg/ExRZ90wkWdsb2JhbACjMhUBAQIJCwoHEQMfvHSFSQSKbg X-IronPort-AV: E=Sophos;i="4.59,305,1288566000"; d="scan'208";a="69955521" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail3-smtp-sop.national.inria.fr with ESMTP; 06 Dec 2010 13:07:02 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20101206120701.SPLH19887.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Mon, 6 Dec 2010 12:07:01 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20101206120701.GNJQ25842.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Mon, 6 Dec 2010 12:07:01 +0000 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id oB6C6vEM010931 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 6 Dec 2010 12:06:58 GMT Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%11]) with mapi; Mon, 6 Dec 2010 12:03:57 +0000 From: David Allsopp To: zaid khalid , "caml-list@yquem.inria.fr" Subject: RE: [Caml-list] help with regular expression Thread-Topic: [Caml-list] help with regular expression Thread-Index: AQHLlTtSMc1yQK4fqUey/9ZvZWrfH5OTThYw Date: Mon, 6 Dec 2010 12:03:54 +0000 Message-ID: References: <926418.88102.qm@web65410.mail.ac4.yahoo.com> In-Reply-To: <926418.88102.qm@web65410.mail.ac4.yahoo.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=X0sWjjQ37bMP4yB/pNNinY3VxVB2n/hmdAjhihaCFGs= c=1 sm=0 a=nfW6s3x8lzwA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=ZOzjf2MOAAAA:8 a=q8F3sgw9YDLZ5C14yRgA:9 a=dXErQhd6s5G5yOObDpFI2hhwSnEA:4 a=CjuIK1q_8ugA:10 a=Fsjrsfmab7wA:10 a=JZDCaEPg8J0A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; ocaml:01 ocaml:01 syntax:01 beginners':01 libref:01 regexp:01 regexps:01 regexp:01 backslash:01 backslash:01 pcre-ocaml:01 aba:98 aba:98 wrote:01 matched:01 zaid Khalid wrote: > Hi Folks > > I want some help in writing regular expressions in Ocaml, as I know how t= o write it > in informal way but in Ocaml syntax I can not. For example I want to writ= e "a* | (aba)* ". This question would better be posted on the beginners' list - http://caml.i= nria.fr/resources/forums.en.html#id2267683 Regular Expressions can be done using the Standard Library with the Str mod= ule (as you've found) - see http://caml.inria.fr/pub/docs/manual-ocaml/libr= ef/Str.html so your expression above (assuming you have loaded/linked str.c= m[x]a) is Str.regexp "a*\\|\\(aba\\)*". The language of regexps is given in= the docs for Str.regexp function. Remember to escape backslash characters = as the regular expression is given in an OCaml string (so to escape a backs= lash in your regexp you have to write "\\\\"). > Another question if I want the string to be matched against the regular e= xpression > to be matched as whole string not as substring what symbol I need to atta= ch to the > substring, i.e if I want only concrete strings accepted (like (" ", a , a= a , aaa,=20 > aba, abaaba), but not ab or not abaa). Use ^ and $ at the beginning and end of your regexp to ensure that it match= es the entire string only - "^\\(a*\\|\\(aba\\)*\\)$" > Hint I am using (Str.regexp) There are other libraries (e.g. pcre-ocaml) which provide different (I woul= d say more powerful, rather than strictly better!) implementations. David From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 60C69BBAF for ; Mon, 6 Dec 2010 14:11:44 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApAFALJv/ExQW+UMgWdsb2JhbACVIo4UFQEBFiIivHWFSQSKbg X-IronPort-AV: E=Sophos;i="4.59,305,1288566000"; d="scan'208";a="91614749" Received: from lo.gmane.org ([80.91.229.12]) by mail1-smtp-roc.national.inria.fr with ESMTP; 06 Dec 2010 14:11:44 +0100 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PPar1-0000A2-6a for caml-list@inria.fr; Mon, 06 Dec 2010 14:11:43 +0100 Received: from avelizy-155-1-50-177.w86-217.abo.wanadoo.fr ([86.217.25.177]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Dec 2010 14:11:43 +0100 Received: from sylvain by avelizy-155-1-50-177.w86-217.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Dec 2010 14:11:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sylvain Le Gall Subject: Re: help with regular expression Date: Mon, 6 Dec 2010 13:11:29 +0000 (UTC) Message-ID: References: <926418.88102.qm@web65410.mail.ac4.yahoo.com> X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: avelizy-155-1-50-177.w86-217.abo.wanadoo.fr User-Agent: slrn/pre1.0.0-18 (Linux) X-Spam: no; 0.00; le-gall:01 regexp:01 pcre-ocaml:01 syntax:01 regexp:01 syntax:01 eol:01 pcre:01 wrote:01 wrote:01 jambon:01 jambon:01 expression:02 match:02 meaningful:04 On 06-12-2010, David Allsopp wrote: > zaid Khalid wrote: >> > >> Hint I am using (Str.regexp) > > There are other libraries (e.g. pcre-ocaml) which provide different (I > would say more powerful, rather than strictly better!) > implementations. > > There is also syntax extension like mikmatch, that helps to write regexp in a very meaningful syntax: match str with | RE bol "a"* | "ab"* eol -> true | _ -> false http://martin.jambon.free.fr/mikmatch-manual.html http://martin.jambon.free.fr/mikmatch.html You can use pcre and str with mikmatch. Regards, Sylvain Le Gall From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B6DBEBBAF for ; Mon, 6 Dec 2010 18:31:38 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoIAAKKs/EzUTWUHkWdsb2JhbACDUJ9sFQEBAQEJCwoHEQQerTSQQIEhgzVzBI11 X-IronPort-AV: E=Sophos;i="4.59,306,1288566000"; d="scan'208";a="83211332" Received: from mx3.wp.pl ([212.77.101.7]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Dec 2010 18:31:38 +0100 Received: (wp-smtpd smtp.wp.pl 238 invoked from network); 6 Dec 2010 18:31:34 +0100 Received: from 18-161.2-0.pl (HELO [192.168.1.101]) (d0@[91.189.18.161]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 6 Dec 2010 18:31:34 +0100 Message-ID: <4CFD1DEF.6070006@wp.pl> Date: Mon, 06 Dec 2010 18:31:27 +0100 From: Dawid Toton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 MIME-Version: 1.0 To: caml-list Subject: Re: help with regular expression References: <926418.88102.qm@web65410.mail.ac4.yahoo.com> In-Reply-To: <926418.88102.qm@web65410.mail.ac4.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [QdOk] X-Spam: no; 0.00; ocaml:01 ocaml:01 syntax:01 regexp:01 unreadable:01 error-prone:01 regexp:01 syntax:01 trivial:01 mli:01 aba:98 aba:98 wrote:01 dynamically:01 compile:01 On 12/06/2010 12:43 PM, zaid khalid wrote: > I want some help in writing regular expressions in Ocaml, as I know how to write it in informal way but in Ocaml syntax I can not. For example I want to write "a* | (aba)* ". > > Another question if I want the string to be matched against the regular expression to be matched as whole string not as substring what symbol I need to attach to the substring, i.e if I want only concrete strings accepted (like (" ", a , aa , aaa, aba, abaaba), but not ab or not abaa). > I also had problems with Str (regexp descriptions being unreadable, error-prone and hard to generate dynamically) and decided just to stop using Str. I have a tiny module [1] made with clarity in mind. It is pure OCaml. It defines operators like $$ to be used in regexp construction. This way syntax of the expressions is checked at compile time. Also, it is trivial to build them at run time. The whole "engine" is contained in a relatively short function HRegex.subwords_of_subexpressions, so I believe anybody can hack it without much effort. I haven't measured performance of this implementation. I expect it to be slow when processing long strings. It's just OK for my needs so far. Anyway, the important part is the module interface. It expresses my point of view on this topic. The code is available in a mercurial repository [2]. The exemple "a* | (aba)* " would become: open HRegex.Operators let rx = (!* !$ "a") +$ (!* !$ "aba") Dawid [1] http://hg.ocamlcore.org/cgi-bin/hgwebdir.cgi/hlibrary/hlibrary/raw-file/tip/HRegex.mli [2] http://hg.ocamlcore.org/cgi-bin/hgwebdir.cgi/hlibrary/hlibrary From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 89454BBAF for ; Mon, 6 Dec 2010 21:41:12 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApAAALPY/ExCbwQZkGdsb2JhbACVJY4XFQEBAQEJCQwHEQQevwWFSQSEX4ki X-IronPort-AV: E=Sophos;i="4.59,307,1288566000"; d="scan'208";a="69988371" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 06 Dec 2010 21:41:12 +0100 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.messagingengine.com (Postfix) with ESMTP id CBC451B6 for ; Mon, 6 Dec 2010 15:41:10 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute3.internal (MEProxy); Mon, 06 Dec 2010 15:41:10 -0500 X-Sasl-enc: e115vNjMqIPp04XpjKTt0JsZDDoEV7M1W0XD/f5teB0p 1291668070 Received: from [192.168.1.206] (64-71-1-165.static.wiline.com [64.71.1.165]) by mail.messagingengine.com (Postfix) with ESMTPSA id 7EBD15E2886 for ; Mon, 6 Dec 2010 15:41:10 -0500 (EST) Message-ID: <4CFD4A83.60501@ens-lyon.org> Date: Mon, 06 Dec 2010 12:41:39 -0800 From: Martin Jambon User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20101023 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: help with regular expression References: <926418.88102.qm@web65410.mail.ac4.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ens-lyon:01 regexp:01 pcre-ocaml:01 syntax:01 regexp:01 syntax:01 eol:01 enforces:01 pcre:01 pcre:01 quantifiers:01 aba:98 wrote:01 wrote:01 caml-list:01 On 12/06/10 05:11, Sylvain Le Gall wrote: > On 06-12-2010, David Allsopp wrote: >> zaid Khalid wrote: >>> >> >>> Hint I am using (Str.regexp) >> >> There are other libraries (e.g. pcre-ocaml) which provide different (I >> would say more powerful, rather than strictly better!) >> implementations. >> >> > > There is also syntax extension like mikmatch, that helps to write regexp > in a very meaningful syntax: > > match str with > | RE bol "a"* | "ab"* eol -> > true > | _ -> > false If I understand correctly the original problem, the solution is: match str with | RE ("a"* | "aba"*) eos -> (* matches always the beginning of the string, eos enforces a match at the end of the string, and the vertical bar has the lowest priority and so parentheses are needed. *) true | _ -> false > http://martin.jambon.free.fr/mikmatch-manual.html > http://martin.jambon.free.fr/mikmatch.html > > You can use pcre and str with mikmatch. I would recommend the pcre variant mostly for one feature that is not provided by str: lazy quantifiers, i.e. "repeat as little as possible before trying to match what comes next". Martin From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B955FBBAF for ; Tue, 7 Dec 2010 00:36:20 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AowBAC4C/UxiizTmlGdsb2JhbACUdTGOJwEBAQEJCwgJEQMfrn6CGYUbiQQBBAQBhUQEhF+JIg X-IronPort-AV: E=Sophos;i="4.59,307,1288566000"; d="scan'208";a="83224470" Received: from nm8-vm0.bullet.mail.ac4.yahoo.com ([98.139.52.230]) by mail2-smtp-roc.national.inria.fr with SMTP; 07 Dec 2010 00:36:19 +0100 Received: from [98.139.52.196] by nm8.bullet.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 23:36:18 -0000 Received: from [98.139.52.165] by tm9.bullet.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 23:36:18 -0000 Received: from [127.0.0.1] by omp1048.mail.ac4.yahoo.com with NNFMP; 06 Dec 2010 23:36:18 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 500697.68376.bm@omp1048.mail.ac4.yahoo.com Received: (qmail 91412 invoked by uid 60001); 6 Dec 2010 23:29:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1291678177; bh=g9h2Z+omqnAqKZRAnJ4iuC+pUh+m+WxjknltRbnebeA=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=V+MUEeYSwmr8adnRqhfolZl0nkfW145/GzwEKrVK5PBLFW/xfqUMyjFuCLOnqD7cf72usL690yUF8xhDsCJJcnrLrN1jeviPuYy++FGpbsjs0LSaR//RoV0B4VSMCOWvKTX1dV8z0tl6dtGeRLwuCcih60m4Ko0UkqKT0HUBvxY= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=SJGY7qIwUsayNleYjRhwdl5FQ7JRAK53zVnBzc8t1PoNXXpqviWmppJtnesnNB7nTPiabwYZOT2MylhQiaI1C63x85b/wJ2MJvNcUBvRWVHKuIbCWgJ7tbiauUy54vQcchnhlG/AJlUc3tRmsd/RLRq1HlCrEzHmLPBl7wMqrnE=; Message-ID: <317197.91134.qm@web65412.mail.ac4.yahoo.com> X-YMail-OSG: 0r8xmoQVM1ntX3G7Byr5Q5O7HPWHodyN64BrDUVyEVDIeZA m0qWPzCnA24JIw2CWEHZt5ifjmAnbAZHImL1z6zhlaMOM_xWDZQA6.zh.ych 2NvORinsu_iHxJ6lo.NBko0Pw_5FmdOaaV8uuirFeSFCKudEGVDAV1CI_vi3 A7dtkcgdzSIosNNb5Hp6dp8fdAOsqQYZC_JhRF4tjkVYB6_eeSM7EKmZ9oRE jyap7xrmfRPMI1qGd_WfuigrTKdcWnC2VGf6a0MfZz4CH4rsADQxpCt2p256 sdp8cKtGI9G93iHNOucH__1HzfnjICmkQOzRf5g-- Received: from [94.173.177.99] by web65412.mail.ac4.yahoo.com via HTTP; Mon, 06 Dec 2010 15:29:37 PST X-Mailer: YahooMailClassic/11.4.20 YahooMailWebService/0.8.107.285259 Date: Mon, 6 Dec 2010 15:29:37 -0800 (PST) From: zaid khalid Subject: HELP : with regular expression To: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2010253898-1291678177=:91134" X-Spam: no; 0.00; regexp:01 pcre-ocaml:01 cheers:01 regexp:01 pcre-ocaml:01 cheers:01 aba:98 abb:98 aba:98 abb:98 define:02 define:02 expression:02 expression:02 match:02 --0-2010253898-1291678177=:91134 Content-Type: text/plain; charset=us-ascii Hi folks Thank you for all your replies. I think I am still struggling to find a solution to my issue using "Str.regexp", and using Pcre-ocaml needs some time to be familiar with as there is no enough examples and discussion on it. Ill put my issue again as if someone can help me to find a solution to it with the "Str" . I want to define regular expression and after that I want to check if particular string is a prefix of the given regular expression. Example: a* | (aba)* so when you test "abaaba" the result will be true (complete match) and when we check "abaa" the result is true as well but when we check "abb" the result is false. I look forward to your suggestions. Cheers, Zaid --0-2010253898-1291678177=:91134 Content-Type: text/html; charset=us-ascii
Hi folks

Thank you for all your replies. I think I am still struggling to find a solution to my issue using "Str.regexp", and using Pcre-ocaml needs some time to be familiar with as there is no enough examples and discussion on it.

Ill put my issue again as if someone can help me to find a solution to it with the "Str" .

I want to define regular expression and after that I want to check if particular string is a prefix of the given regular expression.

Example: a* | (aba)* so when you test "abaaba" the result will be true (complete match) and when we check "abaa" the result is true as well but when we check "abb" the result is false.

I look forward to your suggestions.

Cheers,
Zaid

--0-2010253898-1291678177=:91134--