2948 explained code solutions for 75 technologies

javascriptUse variable as regex

var regex = new RegExp('[0-9]+', 'g');
var matches = 'test_str_1'.match(regex);ctrl + c
var regex

declares new regular expression from string


string representation of our regular expression


which modifiers to use (global in this case)


will contain an array of found matches


matches text string 'test_str_1' agains our regex regular expression