Filtering on the fly is a bit tricky.
A slightly less elegant method is to NSD_GetText in the page leave callback (you are probably doing this anyway?) and check the string. You can take a look at the answer
here where I'm checking a string with regex and checking ASCII codes...