$details = "text...[book=123]...text...";
$details = preg_replace_callback(
"/\[book=(.+?)\]/smi",
function ($m) {
global $skip_books;
$book = $m[1]; // 123
$feed = $m[2]; // 456
return "<div id=\"view_book_".$book."_".$feed."\"></div>";
},
$details
);
With this pattern i can only get $book ($m[1]):
"/\[book=(.+?)\]/smi"`
But i want to get $feed ($m[2]) too, so i replace to this [book=123_456].
How to get "456" ($m[2]) after the underline?
"/\[book=(.+?)_(.+?)\]/smi" ???