I'm trying to understand how preg_match_all() works, and when I look at the documentation on php.net, I see a few examples, but I am puzzled by the lines sent as a template parameter. Is there really a complete, clear explanation? For example, I do not understand what the image in this example means:
preg_match_all("/\(? (\d{3})? \)? (?(1) [\-\s] ) \d{3}-\d{4}/x", "Call 555-1212 or 1-800-555-1212", $phones);
or that:
$html = "<b>bold text</b><a href=howdy.html>click me</a>"; preg_match_all("/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/", $html, $matches, PREG_SET_ORDER);
I made an introductory class in PHP but have never seen anything like it. Some clarifications would be appreciated.
Thanks!
source share