The flags
g finds every match instead of only the first, i ignores letter case, m makes ^ and $ match at the start and end of each line, s lets . match line breaks, and u enables full Unicode support.
Testing replacements
In the replacement field, $1, $2 and so on insert capture groups, and $& inserts the whole match. For example, replacing (\w+)@(\w+) with $2 at $1 swaps the parts around the @.