Jesli mam form input z name = 'test.sections.3.sections.1.sections.4.quantity.form_cos' i chcialbym wybrac sobie po klikniciu na JS numery tych sekcji o ile istnieja to jak to zrobic z preg match w JS
var text2 = 'test.sections.3.sections.1.sections.4.quantity.form_cos';
var matches = text2.match(/sections.(\d+)(.sections.(\d+))?(.sections.(\d+))?/);
i to mi daje wynik
3
.section.1
4
Ale czasem moge miec 'test.sections.3.name_abc.form_cos'
albo 'test.sections.3.sections.6.name_abc.form_cos'
To jak z preg matcha wybrac te numery sekcji o ile istnieja i te nazwe 'name_abc'.