I need to select multiple strings from a single string in that match a patindex. I am selecting the first one using the following code:
CASE WHEN comments like '%[0-9][A-Z][0-9].[0-9]%'
THEN SUBSTRING(comments,PATINDEX('%[0-9][A-Z][0-9].[0-9]%',comments),5)
END AS 'Code'
The pattern is number, letter, number, '.', number
Each of the strings that I need to select can be in any position in the string.
Here is an example string: 5D3.5,SLV,4F2.5,4DR,12/03
I need to select 5D3.5 and 4F2.5 from this string. These will all be random and different and need to use the patindex. There are not always commas separating.