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

[REBOL] Re: Another question

From: greggirwin:mindspring at: 14-Feb-2002 16:00

Hi Alex, << The point is, these escaped quotes should not be treated as grouping constructs, but as normal text. So this: \"Hello world,\" I said should result in [{\"Hello} {world,\"} {I} {Said}]. >> OK, forgive me if I go off-track as I'm trying to understand what you actually want to accomplish. Do you want the escaped chars to remain unchanged, still as escaped chars, or do you want them to be translated into a more normal REBOL form (i.e. unescaped :)? Using the /all refinement with parse, and specifying only a space for the rule, will give you the former.
>> parse/all {\"Hello world,\" I said} " "
== [{\"Hello} {world,\"} "I" "said"]
>> parse/all {\"Hello world,\" "I said"} " "
== [{\"Hello} {world,\"} "I said"] << I'm trying to find "[" + "red" or "blue" or "green" + "]" within a string, *find* it, not just see if a string matches it. >> Sorry, I'm still confused. You can use FIND to find it but my previous example, using block parsing, returns what it found as well.
>> find "this is my [red] car" "[red]"
== "[red] car"
>> parse [this is my [red] car] [some word! set b block! to end]
== true
>> b
== [red] Parse, in this case, finds the block for you and sets the word B to the block it found. Am I getting warmer? --Gregg