Basic Algorithm Scripting - Find the Longest Word in a String

Tell us what’s happening:
Describe your issue in detail here.
I solved this problem but was a bit confused on the regex flag’s. How come when using the /i flag it will return an array with 4 values: the string matched , index value, input value and groups value.

I’ve already solved the problem just wanted some clarification on how the i flag works.

  **Your code so far**
function findLongestWordLength(str) {
let maxLength = 0;
let myRegex = /\S*\w+\S/g // why does this code return an array with proper values 
let iRegex = /\S*\w+\S/i // but this code returns an array with 4 values 'The' index value, input value and groups value
let wordArr = str.match(iRegex);
console.log(wordArr = str.match(iRegex))
for (let i = 0; i < wordArr.length; i++){
  if (wordArr[i].length > maxLength){
    maxLength = wordArr[i].length;
  }
}
return maxLength;
}

console.log(findLongestWordLength("The quick brown fox jumped over the lazy dog"))


  **Your browser information:**

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

Challenge: Basic Algorithm Scripting - Find the Longest Word in a String

Link to the challenge:

The i flag just does a case insensitive search.

Not sure why you think it is affecting the return value?