L
L
lumb2018-08-21 13:51:11
MODX
lumb, 2018-08-21 13:51:11

How to collect url using regular expression?

Deciding how to migrate the database from DLE to Modx Revolution. On the Internet, information from booming x .. east is why a bicycle is being made.
I unload the necessary fields from the dle_post table (the rest has already been transferred) and I don’t know what to do with the url, which should be saved “as they are”
After unloading, we have (example of one line)

INSERT INTO `dle_post` (`id`, `short_story`, `full_story`, `title`, `descr`, `category`, `alt_name`, `editdate`) VALUES
(39, '<p><!--dle_image_begin:http://site.ru/uploads/posts/2011-01/1294417051_220px-taisha-abelar-01.jpg|left--><img src="http://site.ru/uploads/posts/2011-01/1294417051_220px-taisha-abelar-01.jpg" align="left" alt="Лекция Тайши Абеляр (1994г.)" title="Лекция Тайши Абеляр (1994г.)"  /><!--dle_image_end--><br /><br />Каждый из нас может \\"видеть\\" энергию, прямо сейчас, но вы более не осознаете это. Младенцы, в противоположность нам, воспринимают энергию напрямую. Однако когда они становятся старше, \\"Проводник\\" вводит их в мир обычной реальности. Вместо наблюдения аморфной энергии, ребенок однажды сведет ее конфигурации в... таблицу. Игрушку. Собаку. Дерево. Каждое такое преобразование приходит от Проводника.</p>', 'full_story (Дохрена текста с разнообразными символа и прочим)', 'title', 'descr', '194', 'lekciya-tayshi-abelyar-1994g', '1401365620'),

Question 1: how to remove all html characters, image url, alt, title, etc. in the short_story field. (leave only text)?
Question 2: in the DLE database, it stores "url" supposedly in the "alt_name" field, but not completely )) at the output, the url looks like the "id-" field + the "alt_name" + ".html" field,
i.e. in this example, the final url looks like 39-lekciya-tayshi-abelyar-1994g.html , and only lekciya-tayshi-abelyar-1994g is stored in the alt_name field My task is to make sure that the full url appears in the "alt_name" field, that is, it is added to at the beginning of "id with a dash" and at the end of ".html" can this be done using regular expressions or are there any other interesting ways?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nick Sdk, 2018-08-21
@lumb

Question 2: in the DLE database, it stores "url" supposedly in the "alt_name" field, but not completely )) at the output, the url looks like the "id-" field + the "alt_name" + ".html" field,
i.e. in this example, the resulting url looks like 39-lekciya-tayshi-abelyar-1994g.html, and only lekciya-tayshi-abelyar-1994g is stored in the alt_name field

https://regex101.com/r/EoP7pp/1
with point 1 it’s not so simple there, if you use regular expressions,
but you can run such a regular expression in the notepad several times
to replace it with $1
and you should get the desired look

S
Stalker_RED, 2018-08-21
@Stalker_RED

You can try to convert to wordpress, and then to modx. The main content should move.

S
Sergey Vladimirovich, 2018-09-03
@spamboo

store in the description only the text for everything else, use additional fields. next times. and store the url in these fields or something else, and in the templates display it as you like

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question