diff --git a/lib/transformer.js b/lib/transformer.js
index cef721d..dc8d1c6 100644
--- a/lib/transformer.js
+++ b/lib/transformer.js
@@ -131,7 +131,7 @@ function createClassPrefix(classPrefix) {
}
function createIdPrefix(idPrefix) {
- var url_pattern = /^url\(#.+\)$/i;
+ var url_pattern = /url\(#.+?\)/gi;
return function prefixIds(tag) {
var idIdx = getAttributeIndex(tag, 'id');
if (idIdx !== -1) {
diff --git a/tests/fixtures/with-ids.svg b/tests/fixtures/with-ids.svg
index 822b61c..3e4f286 100644
--- a/tests/fixtures/with-ids.svg
+++ b/tests/fixtures/with-ids.svg
@@ -3,7 +3,7 @@
-
+
diff --git a/tests/svg-inline-loader.test.js b/tests/svg-inline-loader.test.js
index 676440c..6f9c785 100644
--- a/tests/svg-inline-loader.test.js
+++ b/tests/svg-inline-loader.test.js
@@ -56,12 +56,11 @@ describe('getExtractedSVG()', function(){
var svgWithStyle = require('raw!./fixtures/with-ids.svg');
var processedStyleInsertedSVG = SVGInlineLoader.getExtractedSVG(svgWithStyle, { idPrefix: 'test.prefix-' });
-
- assert.isTrue( processedStyleInsertedSVG.match(/test\.prefix-foo/g).length === 3 );
+ assert.isTrue( processedStyleInsertedSVG.match(/test\.prefix-foo/g).length === 4 );
// // replaces xlink:href=
assert.isTrue( processedStyleInsertedSVG.match(/xlink:href=/g).length === 1 );
// // replaces url(#foo)
- assert.isTrue( processedStyleInsertedSVG.match(/url\(#test\.prefix-foo\)/g).length === 1 );
+ assert.isTrue( processedStyleInsertedSVG.match(/url\(#test\.prefix-foo\)/g).length === 2 );
});
it('should be able to specify tags to be removed by `removingTags` option', function () {