Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Parse versus Regular Expressions

From: rotenca:telvia:it at: 6-Apr-2003 2:58

Hi all,
> JN> How would you solve the variation I posed in my reply to Ladislav? > JN> (allow the run of equal-length a, b, c segments to occur anywhere > JN> inside the target string?) > > Using an approach similar to the one you used for the RE, i.e. > (using copies this time, for the sake of simplicity): > > any [ > here: > copy As some #"a" > copy Bs some #"b" > copy Cs some #"c" > (if all [ > greater-or-equal? length? As length? Bs > lesser-or-equal? length? Bs length? Cs > ] [print ["Found match at position" index? here]]) > | skip > ] >
I think that it can be done also with a variation of the previous rule, if I understand well the target: parse/all str [ some [ s: some #"a" e: (n: offset? s e) n #"b" n #"c" (print index? s) to end | skip ] ] --- Ciao Romano