.* is greedy so will match everything up to the last '" />' sequence in your string, not the next one. A quick fix would be to use .*? instead. Better yet is to avoid dot-star altogether. Though Perl-focused, this article is worth a read.