LPS-39777 Optimize BrowserSnifferImpl to get rid of Regex

Sorry, Brian, there is no way to remove breaking label here.

It is the only way to efficiently and elegantly do nested loopings control.