Reputation: 6036
I have this string( like python doc ):
"""
1 string with two lines
in this area
"""
"""
2 string, but with more "quotes"
"""
"""
3 string
multiline and "multiquote"
"""
I need:
array(
[0] => 1 string with two lines
in this area
[1] => 2 string, but with more "quotes"
[2] => 3 string
multiline and "multiquote"
)
But, i have:
/(?<!""")(?<=(?!""").)"(?!""")/im
And:
/(\x22\x22\x22)[\w\s\d\D\W\S.]+(?\x22\x22\x22)/i
Upvotes: 1
Views: 91
Reputation: 3867
See this https://eval.in/126887
preg_match_all("/\"{3}(.*?)\"{3}/s", $str, $matches);
Upvotes: 2
Reputation: 4370
why dont you code it like this
$re = '/"""(.*?)"""/is';
$str = '"""
1 string with two lines
in this area
"""
"""
2 string, but with more "quotes"
"""
"""
3 string
multiline and "multiquote"
"""';
preg_match_all($re, $str, $matches);
echo "<pre>";
print_r($matches[1]);
output:
Array
(
[0] =>
1 string with two lines
in this area
[1] =>
2 string, but with more "quotes"
[2] =>
3 string
multiline and "multiquote"
)
Upvotes: 2