Regex doesn't work with multiple lines
4 answers
The Template Modifiers " man page may interest you, especially s ( PCRE_DOTALL
):
If this modifier is set, the dot metacharacter in the pattern matches all characters, including newlines . Without it, newlines are excluded. This modifier is equivalent to Perl / s. A negative class such as [^ a] always matches a newline character, regardless of the setting of this modifier.
Your regex will look something like this:
$regpattern4 = "!<media:description type='plain'> (.*) <\/media:description>!s";
Note. I added the modifier ' s
' after the trailing separator.
+4
source to share
You need to add the s
(DOTALL) modifier :
$regpattern4 = "!(.*)<\/media:description>!s";
0
source to share