The preg_match_all()
-function should find all occurances of this /\]\(.*.md\)/
-Expression, it does, but somehow it detects multiple matches just as one.
My input looks like this:
[example](foo/random/link.md) | [example2](other/some.md)
Lorem ipsum.....
[example3](foo/Readme.md)
It should match the three examples
-links. But it returns:
Array[0] -> ](foo/random/link.md) | [example2](other/some.md)
Array[1] -> ](../Readme.md)
Although example2
should also be found. I am quite confident it is a problem with the use of .*
, but I was not able to come up with something better.
P.S.: For better understanding. I am writing a php-script that translates links from markdown docs to links that are relative to the php-scripts position in the filesystem.