0

I have the following text in a variable in PHP:

[e https://google.es]Lorem ipsum[/e]

And I want to transform it into:

<a href="https://google.es">Lorem ipsum</a>

I have other tags that are not that complex and I have been able to do them with a simple str_replace, but this one requires regex (I suppose) and make it come in [e and there ] could be any content.

  • Looks like you are looking to create a regex, but do not know where to get started. Please check [Reference - What does this regex mean](https://stackoverflow.com/questions/22937618) resource, it has plenty of hints. Also, refer to [Learning Regular Expressions](https://stackoverflow.com/questions/4736) post for some basic regex info. Once you get some expression ready and still have issues with the solution, please edit the question with the latest details and we'll be glad to help you fix the problem. – Wiktor Stribiżew Jun 30 '20 at 10:42

0 Answers0