How to extract sub-pattern from javascript regex matched pattern.
//string:
var str = textcircle c360 s270 ar2 bl2px_br2px_ml0_mr0;
//matching conditions:
var ang = c.match( /c(\d+)\s+/g ); //matches c360
var startang = c.match( /s(\d+)\s+/g ); //matches s180
var ar = c.match( /ar(\d+)\s+/g ); //matches ["ar2 "]
In case of ang, i need extract only (\d+) subpattern, the number 360, not full c360.
In case of startang, i need extract only (\d+) subpattern, the number 180, not full s180.
In case of ar, i need extract only (\d+) subpattern, the number 2, not full ar2, for some reason it is returned as an array, not as a string.