mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-15 15:15:45 +01:00
Refactored regexp escape chars logic
This commit is contained in:
parent
c083dc517e
commit
e7a02a5952
4 changed files with 33 additions and 9413 deletions
|
|
@ -24,16 +24,22 @@ export default {
|
|||
},
|
||||
|
||||
rgxEsc(text){
|
||||
function escape(e){
|
||||
let a = new RegExp('\\'+e, 'g');
|
||||
text = text.replace(a, '\\'+e);
|
||||
}
|
||||
// function escape(e){
|
||||
// let a = new RegExp('\\'+e, 'g');
|
||||
// text = text.replace(a, '\\'+e);
|
||||
// }
|
||||
|
||||
let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
|
||||
for(let e=0, len=chars.length; e<len; e++){
|
||||
escape(chars[e]);
|
||||
}
|
||||
return text;
|
||||
// let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
|
||||
// cache escape + match String
|
||||
|
||||
// for(let e=0, len=chars.length; e<len; e++){
|
||||
// escape(chars[e]);
|
||||
// }
|
||||
// return text;
|
||||
|
||||
let chars = /[-\/\\^$*+?.()|[\]{}]/g;
|
||||
let escMatch = '\\$&';
|
||||
return String(text).replace(chars, escMatch);
|
||||
},
|
||||
|
||||
matchCase(text, mc){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue