From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA05096; Fri, 27 Sep 2002 12:29:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA05082 for ; Fri, 27 Sep 2002 12:29:52 +0200 (MET DST) Received: from mlabdial.hit.bme.hu (mlabdial.hit.bme.hu [152.66.248.201]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8RATpD17554; Fri, 27 Sep 2002 12:29:51 +0200 (MET DST) Received: from localhost (kgergely@localhost) by mlabdial.hit.bme.hu (8.11.6/8.11.6) with ESMTP id g8RATpv29308; Fri, 27 Sep 2002 12:29:51 +0200 Date: Fri, 27 Sep 2002 12:29:51 +0200 (CEST) From: "Kontra, Gergely" To: Xavier Leroy cc: Maxence Guesdon , caml-list@inria.fr Subject: Re: [Caml-list] (Sorry for my last post) lazyness, exceptions?, ocaml syntax rule-of-thumbs In-Reply-To: <20020927101436.A911@pauillac.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >> > a function, which checks, whether a string can match a regexp, and >> > return true or false. Search_forward, again, I think should be return an >> > option, and not trowing an exception. >> See Str.string_match : regexp -> string -> int -> bool [...] > Str.string_match (Str.regexp ".*\\.html$") filename 0 >and > try > ignore(Str.search_forward (Str.regexp "\\.html$") filename 0); > true > with Not_found -> > false Thanks a lot, it was a useful post! But isn't this functionally so often needed, that it worth to wrap it into a function? In many cases it is enough to test, whether a string contains another string, is it a function for that? Gergo +-[Kontra, Gergely @ Budapest University of Technology and Economics]-+ | Email: kgergely@mcl.hu, kgergely@turul.eet.bme.hu | | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 | +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+ . Magyar php mirror es magyar php dokumentacio: http://hu.php.net ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners