Skip to content

Commit

Permalink
fix: adapt regex
Browse files Browse the repository at this point in the history
  • Loading branch information
lucagoslar committed Mar 25, 2022
1 parent 11c41a5 commit 201c6c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/testRegex.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { resolve } from "path";
(() => {
const weights = getWeights();
let patterns = {
xmlTag: { pattern: /^.*<\?xml.*/g, match: 0 },
svgTagOpen: { pattern: /<svg.*/g, match: 0 },
xmlTag: { pattern: /^.*<\?xml.*?>/g, match: 0 },
svgTagOpen: { pattern: /<svg.*?>/g, match: 0 },
svgTagClose: { pattern: /<\/svg>/g, match: 0 },
svgRectTag: {
pattern: /<rect width="25[\d,\.]+" height="25[\d,\.]+" fill="none".*\/>/g,
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function readSVG(filepath) {
return minify(
fs
.readFileSync(filepath, "utf-8")
.replace(/<svg.*/g, "")
.replace(/<svg.*?>/g, "")
.replace(/<\/svg>/g, ""),
{
collapseWhitespace: true,
Expand Down

0 comments on commit 201c6c8

Please sign in to comment.