mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-11 14:53:55 +08:00
Added function to escape regex characters
This commit is contained in:
6
client/src/utility/escapeRegex.ts
Normal file
6
client/src/utility/escapeRegex.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* https://stackoverflow.com/a/30851002/16957052
|
||||
*/
|
||||
export const escapeRegex = (exp: string) => {
|
||||
return exp.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
|
||||
};
|
||||
@@ -11,3 +11,4 @@ export * from './validators';
|
||||
export * from './parseTime';
|
||||
export * from './decodeToken';
|
||||
export * from './applyAuth';
|
||||
export * from './escapeRegex';
|
||||
|
||||
Reference in New Issue
Block a user