We faced a similar problem where I'm working, everyone had to implement a filtering mechanism using user input, including some special characters. While we were comparing solutions it was noted that all but mine had troubles with the special characters.....I was just using indexOf(string)>-1 rather than the RegExp methods. Now, they kind of had me beat when we had to make it case-insensitive, they only had to add the "i" second parameter whereas I had to upper or lower case everything, so I had to type more characters there, but it was still way less than the escaping code they had to add. I guess long story short is, take a look at all of the tools in the box, and make sure you're using the right one for your use-case.
--- In [email protected], Manu Dhanda <manuraj.dha...@...> wrote: > > > The problem is: > I am trying to filter an arraycollection(labels) against the text. Using a > filter function and in there I am trying to use RegExp. > > More specifically, whenever I enter a text like 12.0, it returns me results > with "-" character as well like 12-0 etc. > > So I want that whenever I enter "." in my search, it should only return me > results with "." and NOT "-" and vice-versa. > > Thanks, > Manu.

