New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Searching in datatable for ?param
results in error message
#5949
Comments
this was also reported in forum |
…ke sure they are not applied in filter
At first I wanted to fix this issue in the PHP pattern filter by escaping those quantifiers as I did in JavaScript but then no quantifiers would ever work again there as the filter might be also used in another context. Therefore did it in JavaScript. Also escaped The side effect is that you could no longer write a regex in the search box like |
it is a feature to let users write regular expressions in the search bar (and in API request via do you know if it's possible to detect whether a given search string is a regular expression or not? (if we could detect this, then we could enable regular expression only when input string is indeed regular expression...) I wonder how Google Analytics handles this case. After doing some quick test it seems their datatable search input box works with both regular expressions and simple search. For example if I search for Maybe the best solution is to:
and then we could return the "union" of both searches? |
As mentioned above I would only escape the first character if it is a quantifier in this case. I think it is very tricky to detect it otherwise. Checking for brackets on the left or right or so wouldn't work since even |
I don't think executing a pattern twice is the best idea since a user might get results that he doesn't want. Autodetecting/magic can be very annoying in case the auto detect does not work correctly in a case and you will never know which result you get. Documentation says nothing about regexp:
Maybe we should mention it there and then it is ok. For API users which are usually advanced users this behavior is ok. Best case would be maybe to have two different attributes ( For regular users that use the UI I would personally prefer not to apply a regex by default and treat it as text. IDEs and text editors solve this problem by having a checkbox "Regex". But this makes the UI more complicated again. A solution could be to force advanced users to write regex within a leading and ending slash |
I'll close it for now as it fixes the reported issue. Maybe we can otherwise open a new ticket if needed? |
maybe we could mention regex in the API documentation for |
I did it this morning see previous commit ;) |
Reproduce:
?param
and the search issues a warning message:and then
The text was updated successfully, but these errors were encountered: