You can use the meta character ^ to denote start of string. You can read more about it here. The following pattern will only match lg if it's in the start of the string:
^lg|iphone|blackberry|opera/
You can see a simple example it in action here: http://regexr.com?2vjec