String.prototype.matchadvanced'test 123 foo'.match(/d+/) // β ['123', index: 5, ...]
'test 1 and 2'.match(/d+/g) // β ['1', '2']Use match() to search a string against a regex and return the match results, or null if not found.
Named groups use (?<name>...) syntax and are accessible via result.groups.
Challenge: Implement parseColor(str) that extracts r, g, b from 'rgb(255,128,0)' using named groups.
parseColor('rgb(255,128,0)') // β { r: 255, g: 128, b: 0 }