Skip to content

Commit 9de0a67

Browse files
committed
perf(index): change improves regexp
1 parent 4063571 commit 9de0a67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const filter = (filter, attributeSelector) => new RegExp(filter.map(attribut =>
55
export default postcss.plugin('postcss-attribute-selector-prefix', options => {
66
return nodes => {
77
return nodes.walkRules(rule => {
8-
rule.selector = rule.selector.replace(/\[.*?\]/g, match => {
8+
rule.selector = rule.selector.replace(/\[.*?]/g, match => {
99
if (options.prefix === undefined) {
1010
return match;
1111
}
@@ -18,7 +18,7 @@ export default postcss.plugin('postcss-attribute-selector-prefix', options => {
1818
return match;
1919
}
2020

21-
return match.replace(/(\[.*?="?)(.*?)("?\])/, (match, before, required, after) => {
21+
return match.replace(/(\[.*?="?)(.*?)("?])/, (match, before, required, after) => {
2222
return `${before}${options.prefix}${required}${after}`;
2323
});
2424
});

0 commit comments

Comments
 (0)