Skip to content

Commit

Permalink
fix: support arbitrary values and attribute selectors in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
sastan committed Mar 25, 2021
1 parent 0607023 commit 91b826f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const removeInvalidCandidate = (candidate: string): boolean => {
}

export const extractRulesFromString = (content: string): string[] => {
return (content.match(/[^>"'`\s(){}\]=][^<>"'`\s]*[^<>"'`\s(){}=:#.,;?]/g) || [])
return (content.match(/(?:\[[^[]+]:|[^>"'`\s(){}\]=])[^<>"'`\s()[]*(?:\[[^[]+]|[^<>"'`\s(){}=:.,])/g) || [])
.map(cleanCandidate)
.filter(removeInvalidCandidate)
}
Expand Down

0 comments on commit 91b826f

Please sign in to comment.