That's one way to do it, the regex will then match either the subexpression on the left side of the pipe or the one on the right side. You could also use something like
which will match the whitespaces that make up the linebreak. Another way to do it would be
which uses a flag to tell the dot wildcard to match anything including newlines and then uses a dot to match the newline.