They are both wrong. There is no need to match anything in a backreferennce because Apache has a built in variable for the current URL: %{REQUEST_URI}
.
RewriteRule .? http://www.newdomain.com%{REQUEST_URI} [L,R=301]
As for your question, the meaning of ^
is 'matches at the start of the URLand
$` is 'matches at the end of the URL'. This is probably easiest by example.
^welcome/ matches the url /welcome/a/b/c, /welcome/b/c/d, etc, anything that starts with /welcome
welcome$ matches /a/b/welcome, /a/something/welcome, etc, anything that ends with a 'welcome'
The first RewriteRules you present in your question is 'An URL that has a start and an end and something inbetween', while the second one is 'a URL that has some text and then ends'. Both expressions are very generic and match anything you throw at it.