String search and replace
ssr[x;y;z]
Where
x is a stringy is a pattern as a string (no asterisk)z is a string or a functionreturns x with each substring matching y replaced by:
z if z is a stringz[Y] where z is a function and Y is the matched substringq)s:"toronto ontario"
q)ssr[s;"ont";"x"] / replace "ont" by "x"
"torxo xario"
q)ssr[s;"t?r";upper] / replace matches by their uppercase
"TORonto onTARio"