R
R
Renat Sagdeev2016-10-07 18:53:05
JavaScript
Renat Sagdeev, 2016-10-07 18:53:05

How to parse this text?

There is text in this format:

Текст

Еще что-то

1) Текст, много текста
http://site.ru

2) Несколько строк текста
http://example.com

3) Тоже текст
http://help.ru/news/221

И здесь еще что-то

As a result, get json:
{
id: 1,
title: 'Текст, много текста',
link: 'http://site.ru'
},
{
id: 2,
title: 'Несколько строк текста',
link: 'http://example.com'
}

Probably with the help of regular expressions it is necessary. Who will tell you how? I can't figure out how to do it right.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question