search

Home  >  Q&A  >  body text

Ask a question about regular expressions

Look at other people’s PHP source code written like this
$template = preg_replace_callback("/[\n\r\t]*\{eval\s (. ?)\}[\n\r\t] */is", parse_template_callback_evaltags_2, $template);

function parse_template_callback_evaltags_2($matches) {
return stripvtags('<? '.$matches[2].' ?>','' );

I saw on the Internet that $matches[2] matches the second subexpression, but there is only one parentheses in preg_replace_callback. So what does $matches[2] match? I don’t have a deep understanding of functions and regular expressions, so sorry

小松小松2425 days ago1140

reply all(0)I'll reply

No reply
  • Cancelreply