Here is what I came up with, created a temp table and case statements to define the string types and can select back to extract account id and principal id. Not very elegant but seems to work. Hope this helps someone, kind of don't want to see another charindex for a while.
IF OBJECT_ID('tempdb..#string') IS NOT NULL
DROP TABLE ##string;
SELECT
a.Id
,(CASE
WHEN a1_stop > a1_start
THEN SUBSTRING(a.string,a1_start,a1_stop-a1_start+1)
WHEN a2_stop > a2_start
THEN SUBSTRING(a.string,a2_start,a2_stop-a2_start+1)
ELSE NULL
END) as Account_Id
,(CASE
WHEN p1_stop > p1_start
THEN SUBSTRING(a.string,p1_start,p1_stop-p1_start+1)
WHEN p2_stop > p2_start
THEN SUBSTRING(a.rl,p2_start,p2_stop-p2_start+1)
WHEN p3_stop > p3_start
THEN SUBSTRING(a.string,p3_start,p3_stop-p3_start+1)
ELSE NULL
END) as Principal_Id
into #string
FROM database.dbo.table as a
LEFT JOIN
(SELECT
Id
,SUBSTRING(string,1,36) as string_type
,(CASE
WHEN CHARINDEX('accounts',string) > 0
THEN CHARINDEX('/',string,CHARINDEX('accounts',string))+1
ELSE NULL
END) as a1_start
,(CASE
WHEN CHARINDEX('accounts',string) > 0
THEN CHARINDEX('/',string,CHARINDEX('/',string,CHARINDEX('accounts',string))+1)-1
ELSE NULL
END) as a1_stop
,(CASE
WHEN CHARINDEX('principals',string) > 0
THEN CHARINDEX('/',string,CHARINDEX('principals',string))+1
ELSE NULL
END) as p1_start
,(CASE
WHEN CHARINDEX('principals',string) > 0
THEN CHARINDEX('/',string,CHARINDEX('/',string,CHARINDEX('principals',string))+1)-1
ELSE NULL
END) as p1_stop
,(CASE
WHEN CHARINDEX('accountid',string) > 0
THEN CHARINDEX('=',string,CHARINDEX('accountid',string))+1
ELSE NULL
END) as a2_start
,(CASE
WHEN CHARINDEX('accountid',string) > 0 AND CHARINDEX('&',string) > 0
THEN CHARINDEX('&',string,CHARINDEX('=',string,CHARINDEX('accountid',string))+1)-1
WHEN CHARINDEX('accountid',string) > 0 AND CHARINDEX('&',string) = 0
THEN LEN(string)
ELSE NULL
END) as a2_stop
,(CASE
WHEN CHARINDEX('principalid',string) > 0
THEN CHARINDEX('=',string,CHARINDEX('principalid',string))+1
ELSE NULL
END) as p2_start
,(CASE
WHEN CHARINDEX('principalid',string) > 0 AND CHARINDEX('&',string) > 0
THEN CHARINDEX('&',string,CHARINDEX('=',string,CHARINDEX('principalid',string))+1)-1
WHEN CHARINDEX('principalid',string) > 0 AND CHARINDEX('&',string) = 0
THEN LEN(string)
ELSE NULL
END) as p2_stop
,(CASE
WHEN CHARINDEX('principal_id',string) > 0
THEN CHARINDEX('=',string,CHARINDEX('principal_id',string))+1
ELSE NULL
END) as p3_start
,(CASE
WHEN CHARINDEX('principal_id',string) > 0
THEN LEN(string)
ELSE NULL
END) as p3_stop
FROM database.dbo.table as table
) as b
ON a.Id = b.Id;
select id,
account_id,
principal_id
from #database