Regex Exec zwraca NULL

// When 'g' flag is set, regex remembers last search index. 
// Before next search need to reset it, otherwise search will return null

re.lastIndex=0;
Anxious Alpaca