I have this regex wich works fine only if the strings are on multiline
#\[link.*?href\=\"(.*)?\".*?title\=\"(.*?)\".*?class\=\"(.*?)\".*?\](.*?)\[\/link\]#e
matches ok if second string is on new line
[link href="somehref" title="sometitle" class="someclas"]Text[/link]
[link href="somehref" title="sometitle" class="someclas"]Text2[/link]
matches last one partially if everything is on single line
[link href="somehref" title="sometitle" class="someclas"]Text[/link][link href="somehref" title="sometitle" class="someclas"]Text2[/link]
How do I make it match either, multi or single line? Thank you!