This could be useful in some applications.
If you're needing something like this at the moment and cannot make it yourself, check out:
//var %a whyhello,%b | !.echo -q $regsub(%a,/[^hel]/g,$null,%b) | echo -a %b
Use /ig (include the i) for case-insensitivity.
---Edit---
Also, you can use:
$regsub(%a,/([^hel])/g,$null,%b)
Note the parenthesis. Then use $regml to return what was removed.