I am converting mediawiki markup to html. Stuck at converting image tag properly
Mediawiki Text with Image Tag
[[File:xyz2.png|none|thumb|748x748px]]
I m using preg_replace and following pattern works upto some extent
preg_replace(
"/\[\[(file):(.+?)\]\]/i",
"<img src='".explode("|",'$2',1)[0]."' alt=\"$6\"/>"
[[File:xyz2.png|none|thumb|748x748px]]
);
The output is
<img src="xyz2.png|none|thumb|748x748px" alt="">
However the needed output in this case is
<img src="xyz2.png" alt="">
What modifications in the match / replacement pattern can be done to achieve this ?