I want to get a potentially empty namespace prefix from arbitrary sobject names by using Regexp. All following cases should be covered:
1. StandardObject
2. CustomObject__c
3. NAMESPACE__StandardObject
4. NAMESPACE__CustomObject__c
I've tried groups. I tried lookaheads, but I failed miserably ;-) I am a RegExp dummy.