mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-20 14:45:15 +02:00
Refactored regexp escape chars logic
This commit is contained in:
parent
c083dc517e
commit
e7a02a5952
2243
dist/tablefilter/1-1624429a94932563c8ae.js
vendored
2243
dist/tablefilter/1-1624429a94932563c8ae.js
vendored
File diff suppressed because one or more lines are too long
8
dist/tablefilter/1-303232cf9e9dfa428c1b.js
vendored
Normal file
8
dist/tablefilter/1-303232cf9e9dfa428c1b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7169
dist/tablefilter/tablefilter.js
vendored
7169
dist/tablefilter/tablefilter.js
vendored
File diff suppressed because one or more lines are too long
|
@ -24,16 +24,22 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
rgxEsc(text){
|
rgxEsc(text){
|
||||||
function escape(e){
|
// function escape(e){
|
||||||
let a = new RegExp('\\'+e, 'g');
|
// let a = new RegExp('\\'+e, 'g');
|
||||||
text = text.replace(a, '\\'+e);
|
// text = text.replace(a, '\\'+e);
|
||||||
}
|
// }
|
||||||
|
|
||||||
let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
|
// let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
|
||||||
for(let e=0, len=chars.length; e<len; e++){
|
// cache escape + match String
|
||||||
escape(chars[e]);
|
|
||||||
}
|
// for(let e=0, len=chars.length; e<len; e++){
|
||||||
return text;
|
// escape(chars[e]);
|
||||||
|
// }
|
||||||
|
// return text;
|
||||||
|
|
||||||
|
let chars = /[-\/\\^$*+?.()|[\]{}]/g;
|
||||||
|
let escMatch = '\\$&';
|
||||||
|
return String(text).replace(chars, escMatch);
|
||||||
},
|
},
|
||||||
|
|
||||||
matchCase(text, mc){
|
matchCase(text, mc){
|
||||||
|
|
Loading…
Reference in a new issue