mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
10 lines
243 B
TypeScript
10 lines
243 B
TypeScript
const WILDCARD_RULE = /(\*+)|(\?)/g;
|
|
|
|
export const convertWildcardToRegex = (pattern: string): RegExp => {
|
|
return new RegExp(
|
|
pattern
|
|
.replace(WILDCARD_RULE, (_match, p1) => {
|
|
return p1 ? '(.+?)' : '(.)';
|
|
}),
|
|
);
|
|
};
|