Parse SharePoint lookup value with JavaScript and Regular expression

Javascript logo

If you use SharePoint and get data from lists with JavaScript, once you will receive SharePoint lookup value which looks like '34;#Item title'. There is a way to parse this data with Regular expression and to convert it to an object.

I have created a small method to make it easier. In my case I have got values from parent list of employees. My method returns an object with properties 'id' and 'fullname': Notes of web-specialist
Since 2009