Better regexp matching in sh snippet