Reputation: 2528
Im using tableutils.js
plug in, inside this, its regular expression for filtering is :
var pattern = new RegExp(filter.expr,'i');
its filtering if I type letter T
,
its shows item containing
Tony
Captain
its working pattern is like in MYSQL
LIKE %%
,In regex im using this /^'+filter.expr+'/i
but its not working.Can anyone check my pattern,if i missed out something.Thanks in advance.
Upvotes: 1
Views: 49
Reputation: 781088
If you want to modify the plugin to only match the first letter, change that line to:
var pattern = new RegExp('^' + filter.expr, 'i');
You can't use variables inside regexp literals in /.../
. You have to work with them as strings, then use new RegExp
to convert the string to a RegExp.
Upvotes: 1