- You have to place {-brackets on the same line as the event/condition
- mIRC treats isolated [ and ] chars as evaluation brackets. If you want to use the chars literally, escape them with either $chr() or $(<char>,0)

Working code:
Code:
on *:text:*:#: { 
  if ($regex($1-,/\bHarry\b/i) > 0)  { 
    if ( $window(@alerts)) { 
      aline -p @alerts $timestamp -2 $chr(91) $network $chr(93) 1-2 $chan 1-10 $nick $+ 1: $1- 
    }
    else { 
      window -e0 @alerts test
      aline -p @alerts $timestamp -2 $chr(91) $network $chr(93) 1-2 $chan 1-10 $nick $+ 1: $1-
    } 
  }
}

Suggestion (condensed code):
Code:
on $*:text:/\bHarry\b/i:#: {
  if (!$window(@alerts)) { window -e0 @alerts }
  aline -p @alerts $timestamp -2 $chr(91) $network $chr(93) 1-2 $chan 1-10 $nick $+ 1: $1-
}