INPUT=ABC; INPUT=${(S)INPUT//#%((#b)(*))/°match°}; print $match #no output # Try to quote # INPUT=ABC; INPUT=${(S)INPUT//\#\%((#b)(*))/°match°}; print $match #no output # Anchor with (#s)/(#e) instead: INPUT=ABC; INPUT=${(S)INPUT//(#s)((#b)(*))(#e)/°match°}; print $match #ouput correct: ABC # No S-flag INPUT=ABC; INPUT=${INPUT//#%((#b)(*))/°match°}; print $match #output correct ABC BTW, what were the rules of (#b) flag activity (or (#B))? It was something about "till the end of the parens". -- Best regards, Sebastian Gniazdowski