Pretty much every time I use REPLACE, I mean REPLACE/ALL. But I get bitten because I forget the /ALL.
>> string: "I am pretty sure I feel like I usually want to REPLACE/ALL"
>> replace string "I" "You"
== "You am pretty sure I feel like I usually want to REPLACE/ALL"
Grammar aside, I don't feel like there's a natural boundedness on REPLACE. It seems to me the exception is replacing just one thing, e.g. REPLACE/ONE.
Does anyone have a good argument for why REPLACE shouldn't replace all by default?
It would also be nice to know if any replacements were done. A multi-return parameter which was the count of replacements--or null if no replacements made--would be very useful.
To me this sounds like the perfect place for a regular expression system. Of course, string-like regexps as implemented in other languages go against the Rebol philosophy… but perhaps there may be some way to extend UPARSE to cover this domain?
Feeding UPARSE alternative combinator sets for specific tasks is on the table. There's going to be a limit to how domain-specific and brief the default set can be.
We had an inkling of something called GREB, whose goal is to be a UPARSE-powered command line tool, but it's just a placeholder right now with... all of one lonely test: