Regex search in default search field not working as expected
Regex search in default search field not working as expected
Hi there,
we are trying to make use of regex searching, but there seems to be some problem with it when trying to go for an OR search. For example, when searching for "Berlin or London" I would enter something like "Berlin|London". However, when using the default search field it searches only for "Berlin" until I remove some character and append it again.
Looking at the code of the _fnFilter function in core.filter.js I see that things are researched from scratch under certain conditions, and otherwise the search is applied to the previous result. The conditions include having set the function parameter "force" to something different from 0, or having a search string that is shorter than the previous one. The latter results in the rather unexpected behavior described above (removing some characters and adding them again results in a research in the full set, so that the disjunction is properly applied). Now I wonder if there is any way I can enforce the presence of the "force" parameter, which is undefined when applying the search to the default search field, other than editing the source code (e.g., extending the condition for a full research to include "regex" being true).
I know that I could use a search of the form "(Berlin|London)", which seems to work, but that does not seem to be too user friendly. Furthermore, until the full pair of parentheses is present, with each character I enter I get some errors logged in the console.
Here's a quick fiddle to see the problem: https://jsfiddle.net/piet23/qy1oL5so/. Just enter some search like "Berlin|London" manually (i.e., no copy/paste), and the result will consist of only one row (Berlin).
Best regards