[REBOL] Re: Parse versus Regular Expressions
From: joel:neely:fedex at: 5-Apr-2003 8:44
Hi, Gabriele,
Gabriele Santilli wrote:
> You can use the same technique you use with REs, except that you
> can avoid useless copying.
>
> >> parse "abc" [start: any #a end: (n: offset? start end) n #b n #c]
> == true
> >> parse "aabbcc" [start: any #a end: (n: offset? start end) n #b n #c]
> == true
> >> parse "aaabbbccc" [start: any #a end: (n: offset? start end) n #b n #c]
> == true
> >> parse "aaabbccc" [start: any #a end: (n: offset? start end) n #b n #c]
> == false
>
I'm not clear on which part you're referring to as "useless copying".
Can you help me understand what you meant?
How would you solve the variation I posed in my reply to Ladislav?
(allow the run of equal-length a, b, c segments to occur anywhere
inside the target string?)
-jn-
--
Polonius: ... What do you read, my lord?
Hamlet: Words, words, words.
_Hamlet_, Act II, Scene 2