Skip to content

Commit

Permalink
fixed size regex to handle decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Thompson committed May 14, 2014
1 parent e09a944 commit e03d7d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/types/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ function getSvgRegex() {
}

function getHeightRegex() {
var regexStr = '<svg((.|\n)*)height=(\'|")([0-9]+)(.*)(\'|")' +
'((.|\n)*)>';
var regexStr = '<svg((.|\\n)*?)height=(\'|")(\\d*\\.?\\d*?)' +
'((.|\\n)*?)(\'|")((.|\\n)*?)>';
return new RegExp(regexStr, 'i');
}

function getWidthRegex() {
var regexStr = '<svg((.|\n)*)width=(\'|")([0-9]+)(.*)(\'|")' +
'((.|\n)*)>';
var regexStr = '<svg((.|\\n)*?)width=(\'|")(\\d*\\.?\\d*?)' +
'((.|\\n)*?)(\'|")((.|\\n)*?)>';
return new RegExp(regexStr, 'i');
}

Expand Down

0 comments on commit e03d7d8

Please sign in to comment.