I am working on a tool to convert markdown files to text bundles, revising a great piece of code from Zett to use on macOS since I will be porting my Apple Notes files to Craft.
I have problems parsing all links into an array using grep. No matter how hard I try using options like --null and | xargs -0, the result ends up being split by whitespace characters:
targets=($(grep '!\[.*\](.*)' "$inFile"))
An example: I have a small markdown test file containing the following:
# Allan Falk - ComicWiki
**Allan Falk - ComicWiki**

http://comicwiki.dk/wiki/Allan_Falk
Running the above code creates the following array in where the markdown link is split up like so:

How can I get complete links as individual array entries (they will be processed later individually, using sed for copying files etc.)?