Карманы в методе replace в регулярках JavaScript При работе с методом replace, если мы что-то положим в карман в регулярке, то в строке замены мы можем вставить содержимое этого кармана написав знак доллара $ и номер кармана. Например, - первый карман, - второй карман и так далее. 📌 #instr || Фронтендщик

Channel
Фронтендщик
@frontendshik
On this record: Growth · Engagement · Posts · Cite this entry
1,085subscribers
-11 since we began measuring on 6 August 2026
Risers and fallers across the register · movement among entries of 1,000–3,162.
Register entry
| Telegram ID | -1001208102972 |
|---|---|
| Type | Channel |
| Username | @frontendshik |
| Created | Between 1 March 2018 and 31 August 2021 — estimated from Telegram’s id allocation, not measured. How this range is calculated. |
| First recorded | 6 August 2026 |
| Last confirmed live | 5 September 2026 |
| Measurements held | 9 |
| Confirmed unchanged | 1 time, most recently 5 September 2026 |
| On Telegram | t.me/frontendshik |
Growth
| Measured (UTC) | Subscribers | Change |
|---|---|---|
| 5 Sept 2026, 03:01 | 1,085 | +1 |
| 29 Aug 2026, 01:42 | 1,084 | -1 |
| 25 Aug 2026, 18:24 | 1,085 | -2 |
| 22 Aug 2026, 17:15 | 1,087 | -2 |
| 19 Aug 2026, 07:48 | 1,089 | -1 |
| 16 Aug 2026, 17:48 | 1,090 | -3 |
| 9 Aug 2026, 15:32 | 1,093 | -3 |
| 6 Aug 2026, 12:19 | 1,096 | no change |
| 6 Aug 2026, 05:44 | 1,096 | first reading |
Engagement
20 posts held, back to 27 July 2026 — the reader has not yet reached the start of this channel’s public history, so older posts may sit further back, unread. Read across 1 page of Telegram’s post history, 20 posts per page.
Nothing published in the last 30 days. ERR and ER are rolling 30-day measures, so there is nothing to compute — we hold 20 posts for this entry, the most recent from 6 August 2026. An engagement rate over an empty window would be a number about nothing.
Recent posts
Преимуществом lastIndex является то, что его можно не только читать, но и изменять, начиная поиск с заданной позиции. Смотрите пример: let str = '12 34 56'; let reg = /\d+/g; reg.lastIndex = 2; let res = reg.exec(str) console.log(res); // [34] 📌 #instr || Фронтендщик
Давайте посмотрим на примере: let str = '12 34 56'; let reg = /\d+/g; console.log(reg.lastIndex); // начальное значение 0 let res; while (res = reg.exec(str)) { console.log(res); // [12], [34], [56] console.log(reg.lastIndex); // 2, 5, 8 } 📌 #instr || Фронтендщик
Свойство lastIndex в регулярках JavaScript У регулярного выражения есть свойствоlastIndex. Оно содержит позицию, с которой будет начинать поиск следующий вызов метода exec. To есть при каждом новом вызове метода это свойство будет менять свое значение. 📌 #instr || Фронтендщик
Можно найти не только совпадение, но и разложить его по карманам: let str = '12 34 56'; let reg = /(\d)(\d)/g; let res; while (res = reg.exec(str)) { console.log(res); // [12, 1, 2], [34, 3, 4], [56, 5, 6] } 📌 #instr || Фронтендщик
Такую особенность метода удобно использовать в цикле: let str = '12 34 56'; let reg = /\d+/g; let res; while (res = reg.exec(str)) { console.log(res); // [12], [34], [56] } 📌 #instr || Фронтендщик
После трех вызовов, так как в нашей строке больше нет совпадений с регуляркой, то следующий вызов метода вернет null: let res4 = reg.exec(str); console.log(res4); // null 📌 #instr || Фронтендщик
Давайте посмотрим на примере. Пусть у нас есть следующая строка: let str = '12 34 56'; Пусть у нас есть следующее регулярное выражение: let reg = /\d+/g; Давайте будем последовательно вызывать наш метод для нашей строки: let res1 = reg.exec(str); console.log(res1[0]); // 12 let res2 = reg.exec(str); console.log(res2[0]); // 34 let res3 = reg.exec(str); console.log(res3[0]); // 56 📌 #instr || Фронтендщик
Метод exec в регулярках JavaScript Метод exec осуществляет поиск по строке. Результатом возвращается найденная подстрока и ее карманы. При этом каждый последующий вызов данного метода будет начинать поиск с того места, в котором закончилась предыдущая найденная подстрока. 📌 #instr || Фронтендщик
Давайте найдем все пары чисел и разобьем их цифры по карманам: let matches = str.matchAll(/(\d)(\d)/g); Переберем полученный итерируемый объект циклом и выведем найденные совпадения: for (let match of matches) { console.log(match); // [12, 1, 2], [34, 3, 4], [56, 5, 6] } 📌 #instr || Фронтендщик
Глобальный matchAll в регулярках JavaScript Метод matchAll возвращает все совпадения в виде итерируемого объекта, каждый элемент которого содержит массив из найденного и его карманов. Метод может вызываться только с модификатором g. Давайте посмотрим на примере. Пусть у нас есть следующая строка: let str = '12 34 56'; 📌 #instr || Фронтендщик
Пример Давайте получим массив всех цифр: let str = '1 23 456 789'; let res = str.match(/\d/g); В результате в переменную запишется следующее: ['1', '2', '3', '4', '5', '6', '7', '8', '9'] 📌 #instr || Фронтендщик
Showing the 12 most recent of 20 posts we hold for @frontendshik. View and reaction counts are the latest single reading for each post, not a live figure, and a recent post is still accumulating both. A view count marked ≈ was rounded by Telegram before we ever saw it — t.me prints views in full below 1,000 and to three significant figures above, so ≈1,200,000 means somewhere between 1,150,000 and 1,249,999. Unmarked counts are exact. Text is reproduced from the public post preview and truncated for length.
Cite this entry
A live page changes as we take new readings, so a citation should name the measurement it is based on, not just the URL. The line below cites the subscriber count as measured 5 September 2026 — this entry's latest reading, not the date you are reading this.
“Фронтендщик” (@frontendshik), 1,085 subscribers as measured 5 September 2026. Telegram Register, tgregister.com/channel/frontendshik.
Full measurement history, CC BY 4.0. Every reading this register holds for this entry, not just the latest one, as a dated, downloadable record: CSV · JSON. Free to use with attribution to tgregister.com. Each file carries its own generation timestamp, which is the figure to cite for exactly when the data was retrieved.