Reputation: 670
I am using a regular expression to filter a link from a HTML page like so:
(?<=data-ng-non-bindable data-src=\")(.*?)(?=\" data-caption)
How do I change it so that I get multiple results, not only the first one?
Upvotes: 2
Views: 51
Reputation: 18621
With sed
, you replace strings, not extract. There are options you may set to actually output replaced substrings only, there is always a big problem with matches on the the same line.
Due to this, the easiest will be using grep
with -oP
options:
grep -oP '(?<=data-ng-non-bindable data-src=").*?(?=" data-caption)' file > outfile
Double quotation marks are not special.
Upvotes: 1