0

I have a data store having a Note field (a textarea) and want to display all Notes satisfying a user input (even metacharacters).

I've written the following function to handle this:

    function notefilter() {
        var newfilter = Ext.getCmp('searchnote');
        var searchStr = newfilter.getValue();
        searchStr = searchStr.replace('?', '\\?').replace('*', '\\*').replace('+', '\\+').replace('{', '\\{').replace('}', '\\}').replace('[', '\\[').replace(']', '\\]').replace('(', '\\(').replace(')', '\\)').replace('|', '\\|').replace('$', '\\$').replace('^', '\\^');

        var re = new RegExp(".*" + searchStr + ".*", "ig");
        Ext.getCmp('notesgrid').store.filter('Note', re);
    }

However the filter fails to search for metacharacters even after escaping them, but it works are all other alphanumeric input.

Am I missing something ?

Thanks in advance !

Edited by happygeek: fixed formatting

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by deepak.marur
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.