scans string until pattern is encountered. If pattern will not be encountered then it returns nil but if scan_anyway is true then it scans until the end of the string.
[Validate]