Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You want to find all instances of a pattern within a string.
Use the RegExp exec method and the global flag (g) in a loop to locate all instances of a pattern, such as any word that begins with t and ends with e, with any number of characters in between: