Hi,
There is a slightly less hacky way of doing the same thing which is a bit more manageable.
Once you have your Geoserver WMS layer inititalised you can use:
var cqlFilter = "NUMBER0%3D'B5235>"
FilterLayer.setParams({CQL_FILTER:cqlFilter })
This way, you can dynamically update the filter and apply it to the layer as and when you need to update the layer selection.
There is often a bit of faffing around making sure that you have all your URL components encoded correctly (e.g. representing white space as "%20" and equals as "%3D", but once you have a working pattern, it's very helpful.