411 REFERENCE · Wikibooks
Rebol Programming/Language Features/Parse/Splitting using specific delimiters
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
The parse string none expression breaks down when:
you want to specify which characters shall be treated as whitespace
you want to specify which characters shall be treated as delimiters
you don't want the quotation marks to be handled specially
you need something other than simple splitting
Examples
These examples show, how you can influence how the PARSE function handles whitespace, or how you can use specific delimiters, instead of the default ones.
To eliminate the special treatment of whitespace use the /ALL PARSE refinement
parse/all "only common delimiters; split the text, now" none
; == ["only common delimiters" " split the text" " now"]
If you have different delimiter(s) you can supply a string rule to PARSE containing your delimiters.
The #"#" character as a delimiter
parse "red#blue#green" "#"
; == ["red" "blue" "green"]
The space character as a delimiter
parse/all "red blue^-green" " "
; == ["red" "blue^-green"]
The #"#" and #"*" characters as delimiters
parse "red#blue*green" "#*"
; == ["red" "blue" "green"]
Note that the order of the characters in the delimiter string is not important.