improved input filter to prevent replace of square brackets without piped arguments