Please tell me how to replace the a tag with regularities

Please tell me how to regularly replace the < "> of a tag with @-sharp $without affecting a href links and other tags
it is not allowed to extract and replace a tag alone

<div>
    <div class="bt">2222</div>
    <ul>
        <li>1</li>
        <li>2</li>
    </ul>
    <a href="https://segmentfault.com">ok</a>
</div>

result:

    <div>
        <div class="bt">2222</div>
        <ul>
            <li>1</li>
            <li>2</li>
        </ul>
        @a href=-sharp https://segmentfault.com -sharp $ ok @/a$
        @a href=-sharp https://segmentfault.com -sharp $ acb @/a$
        @a href=-sharp https://segmentfault.com -sharp $ 123 @/a$
    </div>
Php
May.06,2022

fdfds
    </a>
</div>';

$s = preg_replace('/<a([\s\S]*?)href="([\s\S]*?)"([\s\S]*?)>([\s\S]*?)<\/a>/', '@a${1}href=-sharp${2}-sharp${3}\$${4}@\/a\$', $s);

it should be like this. If you need a space, you can add it to the appropriate place depending on the situation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b57c-2c27b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b57c-2c27b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?