Andrew,

Thanks but this doesn't seem to work.

The REBOL parse documentation does not look very comprehensive to me for a
feature which is obviously very powerful. I am not clear from reading it how
your rules starting with copy are intended to work.

Also can the rules enforce specific character sequences

e.g. dd/mm/yyyyy because my reading of a rule like
2 digit "/" 2 digit "/" 4 digit is that it would allow values like
31   /01/  1997 i.e. embedded white space between terms?

John


----- Original Message -----
From: "Andrew Martin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 12, 2001 3:25 AM
Subject: [REBOL] Re: Parse query


> John wrote:
> > How can I use parse to extract particular subtrings from a string e.g.
> telephone no (NNN-NNN-NNNN), date (DD/MM/YYYY).
>
> Try something like:
>
> Digit: charset "0123456789"
>
> str: "abcdefgh 09/11/2001 xyz"
>
> Date: [
>     copy Day 2 Digit #"/" copy Month 2 Digit #"/" copy Year 2 4 Digit
>     ]
>
> Telephone: [
>     copy Number [
>         3 Digit #"-" 3 Digit #"-" 4 Digit
>         ]
>     ]
>
> parse str [
>     Date | Telephone | skip
>     ]
>
> > Does the to keyword only support simple character string arguments?
>
> Yes. It's been requested to feedback that more interesting arguments be
> supported.
>
> > Should I use find function instead?
>
> 'parse is nicer to use, once you use 'skip. :-)
>
> Andrew Martin
> ICQ: 26227169 http://valley.150m.com/
> -><-
>
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to