親フォルダ タブ
01.<?php
02.session_cache_limiter('nocache');
03.session_start();
04. 
05.?>
06.<!DOCTYPE html>
07.<html lang="ja">
08.<head>
09.<meta content="width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no" name="viewport">
10.<meta charset="UTF-8">
11.<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css">
12. 
13.<style>
14..param {
15.    width: 400px;
16.}
17.textarea {
18.    width: 50%;
19.    height: 200px;
20.}
21.</style>
22. 
23.<script>
24.</script>
25. 
26.</head>
27.<body>
28.<h1>アンカー取得 正規表現</h1>
29. 
30.<div id="main">
31.    <form method="post">
32. 
33.        <p>パターン:<input class="param" type="text" required name="pattern" value="<?= htmlentities($_POST["pattern"]) ?>"></p>
34.        <p>文 字 列:<textarea name="text"><?= $_POST["text"] ?></textarea></p>
35.        <p><input type="submit" name="send" value="送信"></p>
36. 
37.    </form>
38.</div>
39. 
40.<?php
41.if ( $_SERVER['REQUEST_METHOD'] == "POST" ) {
42. 
43.    $real_pattern = html_entity_decode($_POST["pattern"]);
44. 
45.    $re = "/{$real_pattern}/sm";
46.    $str = $_POST['text'];
47. 
48.    preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
49. 
50.    foreach( $matches as $i => $list ) {
51.        foreach( $list as $j => $value ) {
52.            $matches[$i][$j] = htmlentities($value);
53.        }
54.    }
55. 
56.    print "<pre>";
57.    print_r($matches);
58.    print "</pre>";
59. 
60.}
61.  
62.?>
63. 
64. 
65.</body>
66.</html>
データの用意

▼ A 要素を取得する正規表現( 簡易 )
<a.+?href=".+?".*?>.+?<\/a>
. を使用してできるだけ解りやすくしています オンラインツールでのテスト https://regex101.com/
日本郵便のページ より、デベロッパーツールで body の outerHTML を取得して使用します


デベロッパーツールでタイトル位置調整
<span style="
    display: inline-block;
    vertical-align: top;
">文 字 列:</span>