Try using [\s\S]
, which means all space and non-space characters, instead of .
. Also, there's no need to add <funcion>
and </funcion>
in match groups.
/<funcion>([\s\S]*?)<\/funcion>/s
Also, keep in mind that the best way to do this is parsing the XML using a XML parser. Even if it's not a XML document, as you mentioned on your comment, extract the part that should be parsed and use XML parser to parse it.