I'm using the regex to search for all instances of the string that matches Hello[n] pattern.
var str = 'Hello[0] hello[2] hell Welcome to JavaScript.';
var regex = /hello+/gi;
var result = str.match(regex);
The code above produces the following outcome.
[ 'Hello', 'hello' ]
I want to know how to modify my regex to produce the following result.
[ 'Hello[0]', 'hello[1]',..... ]