this is my full HTML Code to find and replace:
<figure class="wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter">
<div class="wp-block-embed__wrapper">
<blockquote class="twitter-tweet" data-width="550" data-dnt="true">
<p lang="en" dir="ltr">
<a href="https://twitter.com/hashtag/CrisisCore?src=hash&ref_src=twsrc%5Etfw">#CrisisCore</a>
–Final Fantasy VII– Reunion is coming to PS5, PS4, Xbox Series X|S, Xbox One, Nintendo Switch and Steam on December 13.<br><br>Here's how it'll run on each platform.
<a href="https:// t.co/ 2IdZP6yQGn">pic.twitter.com/2IdZP6yQGn</a>
</p>
— FINAL FANTASY VII (@finalfantasyvii)
<a href="https://twitter.com/finalfantasyvii/status/1593246579489505281?ref_src=twsrc%5Etfw">November 17, 2022</a>
</blockquote>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
</figure>
(Shortner URL to.co dont work in stackoverflow)
and i need only the Twitter Share URL:
https://twitter.com/finalfantasyvii/status/1593246579489505281?ref_src=twsrc%5Etfw
and now can i replace this in: [embed width="550"]$1[/embed]
but the regex need to serach the full html and replace it in the short code.
Can we say: find the class= * wp-block-embed-twitter and find the Twitter-URL (https://twitter.com/finalfantasyvii/status/1593246579489505281?ref_src=twsrc%5Etfw) and then replace it in the Short-Code?
This code changes again and again
<a href="https://twitter.com/hashtag/CrisisCore?src=hash&ref_src=twsrc%5Etfw">
#CrisisCore
</a>
–Final Fantasy VII– Reunion is coming to PS5, PS4, Xbox Series X|S, Xbox One, Nintendo Switch and Steam on December 13.<br><br>Here's how it'll run on each platform.
<a href="https:// t.co/ 2IdZP6yQGn">pic.twitter.com/2IdZP6yQGn</a>
and this code:
— FINAL FANTASY VII (@finalfantasyvii)
<a href="https://twitter.com/finalfantasyvii/status/1593246579489505281?ref_src=twsrc%5Etfw">
November 17, 2022
</a>
Unfortunately, I have no idea about regex at all. I have familiarized myself with a few examples from https://regex101.com/.
Is there maybe a regex generator?
Or what is the best way to handle so much code with the parser regex?
maybe someone can help me here? Or tell me where I can get help.
/status/and?ref_src=twsrc%5Etfw?https://twitter.com/WalkingDead_AMC/status/1595099944636932097the ?ref_src could therefore also be deleted[embed width="550"]https://twitter.com/WalkingDead_AMC/status/1595099944636932097[/embed]