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

[REBOL] Re: Shutting off parse features

From: carl:cybercraft at: 9-Mar-2002 12:23

On 09-Mar-02, Terry Brownell wrote:
> When parsing a string such as {Hello world, "this to" is an > example;} parse will remove the comma, and the semi... and takes > anything within quotes as a single value. > Sometimes I just want to parse spaces so we get... > ["Hello" "world," "this" "to" "is" "an" "example;"] > Of course some rules could be created to do this, but it seems there > should be an option to parse that "shuts off" the ,, ; and "" > features... eg: parse/white
Well, the 'all refinement let's you parse everything except what you tell it not to parse. ie...
>> a: {Hello world, "this to" is an example;}
== {Hello world, "this to" is an example;}
>> parse/all a " "
== ["Hello" "world," "this to" "is" "an" "example;"] Though your "this to" becomes one string instead of two. Close to what you want though, and stripping out the speach-marks first would be one option. ie...
>> parse/all replace/all a "^"" "" " "
== ["Hello" "world," "this" "to" "is" "an" "example;"] gets your example right, at least. HTH. -- Carl Read