diff --git a/README.md b/README.md index 37bfab1..4ce65ef 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ type RenameOptions = { * The default is to match the name with word boundaries on either side, but you can change this to match only the start or end of the name, or to match more or less than a whole word. * * @default ```js - * (key: string) => `(:^|[^-&;:_])(${key})(:$|[^-&;:_\./])` + * (key: string) => `(:^|[^-&;:_])(${key})(?![a-zA-Z0-9_-])(:$|[^-&;:_\./])` * ``` */ matchClasses?: (key: string) => string; diff --git a/src/options.ts b/src/options.ts index 63ea5de..7b13103 100644 --- a/src/options.ts +++ b/src/options.ts @@ -6,5 +6,5 @@ export const defaultOptions = { by: 'whole', }, targetExt: ['html', 'js'], - matchClasses: (key: string) => `(:^|[^-&;:_])(${key})(:$|[^-&;:_\./])`, + matchClasses: (key: string) => `(:^|[^-&;:_])(${key})(?![a-zA-Z0-9_-])(:$|[^-&;:_\./])`, } satisfies RenameOptions; diff --git a/src/types.ts b/src/types.ts index 571ed68..9d66665 100644 --- a/src/types.ts +++ b/src/types.ts @@ -56,7 +56,7 @@ export type RenameOptions = * The default is to match the name with word boundaries on either side, but you can change this to match only the start or end of the name, or to match more or less than a whole word. * * @default ```js - * (key: string) => `(:^|[^-&;:_])(${key})(:$|[^-&;:_\./])` + * (key: string) => `(:^|[^-&;:_])(${key})(?![a-zA-Z0-9_-])(:$|[^-&;:_\./])` * ``` */ matchClasses?: (key: string) => string;