SET @WeftPattern = N'1B1A1B2[1C1D]2[1A1B]1A1E30[1A1D]1A1E2[1A1B]2[1C1D]2[1A1B]2[1C1D]2[1A1B]2[1C1D]2[1A1B]2[1C1D]2[1A1B]2[1C1D]2[1A1B]2[1C1D]1A'
DECLARE @str nvarchar(max), @i int, @j int, @strfind nvarchar (max)
SET @str = @WeftPattern
SET @i=CHARINDEX('[',@str,1)
WHILE @i > 0
BEGIN
SET @j = 1
WHILE ISNUMERIC(SUBSTRING(@str,@i-@j,1)) = 1
SET @j += 1
SET @str = LEFT(@str,@i-@j) + ' ' + SUBSTRING(@str,@i-@j+1,@j-1) + '(' + SUBSTRING(@str,@i+1,LEN(@str))
SET @i = CHARINDEX('[',@str,@i)
END
set @strfind = REPLACE(REPLACE(@str,']',') '),' ',' ')
select replace(@strfind, ' ', char (13))
risultato
1B1A1B
2(1C1D)
2(1A1B)
1A1E
30(1A1D)
1A1E
2(1A1B)
2(1C1D)
2(1A1B)
2(1C1D)
2(1A1B)
2(1C1D)
2(1A1B)
2(1C1D)
2(1A1B)
2(1C1D)
2(1A1B)
2(1C1D)
1A
adesso e' perfetta, grazie dell' aiuto