It corresponds to one line of text.
It will not correspond to a multi-line String, because ^ corresponds to the beginning of input, and $ corresponds to the end of input. If between them there is a new line ( \n ) or a carriage return character ( \r ) - it fails.
For example, 'foo'.match(/^.*$/) returns foo .
But 'foo\nfoo'.match(/^.*$/) returns null .
source share