lazd / gulp-replace

A string replace plugin for gulp
MIT License
496 stars 88 forks source link

Regex doesn't work as it should #92

Closed satodavan closed 7 years ago

satodavan commented 7 years ago

I have regex https://regex101.com/r/esi04u/1 , but gulp-replace doesn't see capturing group in regex

.pipe(replace(/\<i role="img" class="icon-([^\"]+).*?\<\/i>/g, '<svg class="icon icon-$1" role="img"><use xlink:href="img/sprite.svg#$1"/></svg>'))

I have wrong result after this. For example tag <i role="img" class="icon-fav-in"></i> replaced with <svg class="icon icon-" role="img"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#"></use></svg>

satodavan commented 7 years ago

Sorry, It been conflict with gulp-changed-in-place. gulp-replace works fine