JavaScript Tips — Named capturing groups in regular expressions

preview_player
Показать описание
Named capturing groups in JavaScript regular expression let you assign easy to read names to the group. You can then use this name to look up the text the group matches

This makes your regular expressions more resilient because extracting matches won't depend on the order or number of capturing groups. It also makes the code much easier to read because it is easy to tell which group is being accessed

Рекомендации по теме
Комментарии
Автор

yes, i've been using capture groups for a while now and they are very nice for maintainability.

FunctionGermany