3
I have the following text::
$texto = "Olá {cliente}, seja bem vindo ao site {site}!
Aqui você terá acesso as seguintes opções:
{opcoes}
Estes dados foram gerados automaticamente em {data}
Pela empresa {empresa}";
Note that we have several tags
between the keys, I need to draw up a PHP
which retrieves only these tags, and places them within a array()
, because I will include the tags in a differentiated table.
How could I retrieve only those inside the keys?
The result I would like would be:
Array (
[0] => {x},
[1] => {y}
)
You were faster :P
– Inkeliz
Well that, perfect answer.
– Sr. André Baill
:) hehe Ussain preg_match @Inkeliz :P
– Miguel
@Andrébaill added another option with an alternative regular expression
– Miguel
Okay Miguel, tell me something... can I recover this data by a jquery? Example, I have a field called Description, normal input, as I type the texts, it will list these tags below?
– Sr. André Baill
This way you send the whole text to the server and are processing it with php, but could send the server only tags, IE, do this process in javascript and send only tags
– Miguel
In fact, I wanted to display, on the screen, what are the tags of the text that is being elaborated, or that it will paste inside the field... so that he knows the tags that will use.
– Sr. André Baill
Let’s go continue this discussion in chat.
– Miguel