@KEEP -- the inverse of @STRIP

May 29, 2008
565
4
Groton, CT
function keep=`%@strip[%@strip[%1,%2],%2]`


E.g., strip everything but digits; i.e., keep only the digits:
> echo %@keep["0123456789",lskjfow68768;lk;l]
68768

Keep only the vowels:
> echo %@keep["aeiou",%@reverse[abcdefghijklmnopqrstuvwxyz]]
uoiea

Dave C.
 
May 20, 2008
11,048
90
Syracuse, NY, USA
I could, sure. But as it's (A) a reasonable idea, and (B) easy to implement, I think it's quite likely Rex will do it in the next version.
Could, probably easily, overload @STRIP with a third, optional, parameter ([,-]) reversing the sense (strip/keep) of the first parameter.