ng2-table icon indicating copy to clipboard operation
ng2-table copied to clipboard

Invalid regular expression: /?/

Open MichalRafalski opened this issue 10 years ago • 1 comments

Hello, there is a tiny bug in filtering function. If you write in field "Filter all columns" just "?" in console you get

EXCEPTION: Invalid regular expression: /?/: Nothing to repeat

and it crashes the application.

MichalRafalski avatar Oct 19 '16 11:10 MichalRafalski

I also noticed that filtering by some special characters breaks the application. My workaround was to escape the special characters in all filter strings using a function:

private escapeSpecialCharacters(inputText: string) {
    return inputText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
}

tudorciotlos avatar Nov 22 '16 06:11 tudorciotlos