Regular Expressions: Find Characters with Lazy Matching

Tell us what’s happening:
How to make this to return the following array?
[“ti”, “tani”, “titani”]

Your code so far

let text = "titanic";
let myRegex = /t[a-z]*?i/; // Change this line
let result = text.match(myRegex);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

With loop with different regex.
loop with index

What is index in the second example?

index in loop function, while or for or for each. pick what you want.

Why would you want to return an array? That’s not what the challenge is asking.