I
I
Ilya Parshakov2018-06-29 21:15:13
PHP
Ilya Parshakov, 2018-06-29 21:15:13

How to extract attribute values ​​from a string and write them to a string while preserving the sequence?

Hello! For example, there is a line:

пример текста class="main" пример текста id='second' пример текста class='peoples' пример текста пример текста

How to extract all the values ​​of the class and id attributes from it, writing it to a variable, separated by a space, keeping the sequence, as in the original line, and get this look:
.main #second .peoples
That is, roughly speaking, to assemble the selector.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-06-29
@parschakov

https://repl.it/repls/MaroonElegantFields

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question