From: Ken Wakita <wakita@is.titech.ac.jp>
To: prevost@maya.com
Cc: caml-list@inria.fr
Subject: Re: Labels and operators
Date: Thu, 22 Jun 2000 10:48:35 +0900 [thread overview]
Message-ID: <20000622104835K.wakita@is.titech.ac.jp> (raw)
In-Reply-To: <87bt0y71f9.fsf@isil.localdomain>
Hello.
I tried the same with the Str module. Except for the parenthesis, it
seems ok to me.
Ken
let pmatch s ~pat ?(direction = `forward) ?(pos = 0) () =
match direction with
`forward -> Str.search_forward ~pat s ~pos
| `backward -> Str.search_backward ~pat s ~pos
let (=~) s regexp = pmatch s (Str.regexp regexp)
# ("Hello world!" =~ "[a-z]+") ();;
- : int = 1
# ("Hello world!" =~ "[A-Za-z]+") ();;
- : int = 0
# ("Hello world!" =~ "[A-Za-z]+") ~direction: `backward ~pos: 12 ();;
- : int = 10
# ("Hello world!" =~ "[A-Za-z]+") ~direction: `backward ~pos: 10 ();;
- : int = 10
#
next prev parent reply other threads:[~2000-06-22 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-19 4:14 John Prevost
2000-06-22 1:48 ` Ken Wakita [this message]
2000-06-22 5:19 ` Jacques Garrigue
2000-06-24 14:44 ` Markus Mottl
2000-06-24 18:03 ` John Prevost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000622104835K.wakita@is.titech.ac.jp \
--to=wakita@is.titech.ac.jp \
--cc=caml-list@inria.fr \
--cc=prevost@maya.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox