const regex = new RegExp('(Заявка на забор документов)\\n(Имя - )(.*)\\n(Фамилия - )(.*)\\n(E-mail - )(.*)\\n(Мобильный телефон - )(.*)\\n(Улица - )(.*)\\n(Дом - )(.*)\\n(Корпус - )(.*)\\n(Строение - )(.*)\\n(Квартира - )(.*)\\n(Время забора документов - )(.*)\\n(Комментарий - )(.*)', 'gm')
const str = `Заявка на забор документов
Имя - Владимир
Фамилия - Симигин
E-mail - v.simigin@gmail.com
Мобильный телефон - +79141861116
Улица - Большая Черемушкинская
Дом - 20
Корпус - 1
Строение -
Квартира - 34
Время забора документов - 13:00 - 16:00
Комментарий - Код домофона 39ключ7289`;
const subst = `\1,\3,\5,\7,\9,\11,\13,\15,\17,\19,\21,\23`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions