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

Filtering (Regex) broken, after Wildcard (e.g. ?, *, ...)

Open wOOx92 opened this issue 10 years ago • 2 comments

After inputting an asterisk (*) or a questionmark (?) at the beginning of a filter-input-field, the regex gets broken.

An Error occurs in "core.umd.js": core.umd.js:3427 EXCEPTION: Invalid regular expression: /*/: Nothing to repeat

Could you please fix this?

wOOx92 avatar Nov 17 '16 07:11 wOOx92

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

https://github.com/valor-software/ng2-table/issues/412

@wOOx92 , here you can see solution.

webcat12345 avatar Mar 28 '17 15:03 webcat12345