Salesforce interview question

foobar stuff, string matching/manipulation