XPages Field Replace Illegal Characters

Hi,

I have a edit box in XPages for which the contents are being passed to the ‘search’ part of a view upon submit.

This works perfectly fine except when I enter an illegal character (e.g., “!” or “[”).

How can I strip these from the string…?

Thanks