ecmascript 6 - Regex group matching parameters with parantheses -
my data like
new abc(false, new g()), //success new cba(true, new fhhhhhfrrfr8()),//fail new bzx(false, new zzzz44d()) //success i'm trying match name of types, parameters , commentary. far tried new (.+)\((.+)\),? ?\/\/(success|fail), yields group 1 abc(false, new g, group 2 ) , 3 success, however, desire abc first group match, false, new g() second , success third. new instanciation kills regex.
you don't want character (.) in types, right? think can include letters, won't want spill on parameters.
/new ([a-za-z]+)\((.+)\),? ?\/\/(success|fail)/i give go.
Comments
Post a Comment