Skip to content

Commit

Permalink
fix(id-class-value): fix ineficient regex
Browse files Browse the repository at this point in the history
Replacing the capturing group quantifier ( ... )* with a non-capturing group quantifier (?: ... )*
to reduce the risk of exponential backtracking.

htmlhint#1147
  • Loading branch information
bebehr committed Feb 19, 2024
1 parent 35aecf5 commit 5163d31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/rules/id-class-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
'The id and class attribute values must be in lowercase and split by a dash.',
},
hump: {
regId: /^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,
regId: /^[a-z][a-zA-Z\d]*(?:[A-Z][a-zA-Z\d]*)*$/,
message:
'The id and class attribute values must meet the camelCase style.',
},
Expand Down

0 comments on commit 5163d31

Please sign in to comment.