title: Extract string between double quotes in SQL
body: <p>I have a string and I need to return the characters between the double quotes</p>
  
  <blockquote>
    <p>'(("Name 1" and "Name 2") or "Name 3")</p>
  </blockquote>
  
  <p>I need to return</p>
  
  <pre><code>Name 1
  Name 2
  Name 3
  </code></pre>
  
  <p>I have used the function below to split the string but I am getting the (( and the Or and AND etc .. which I don't want and unfortunately I can't be certain of all the other characters that could be included so removing them or replacing them isn't really feasible.</p>
  
  <pre><code>ALTER FUNCTION [dbo].[fn_SplitString] 
  ( 
     @string NVARCHAR(MAX), 
     @delimiter CHAR(1) 
  ) 
  RETURNS @output TABLE(ID int, splitdata NVARCHAR(MAX) 
  ) 
  BEGIN 
     DECLARE @start INT, @end INT, @Count INT
     set @Count = 1
     SELECT @start = 1, @end = CHARINDEX(@delimiter, @string) 
     WHILE @start &lt; LEN(@string) + 1 BEGIN 
        IF @end = 0  
           SET @end = LEN(@string) + 1
  
         INSERT INTO @output (ID, splitdata)  
         VALUES(@Count, SUBSTRING(@string, @start, @end - @start)) 
         SET @start = @end + 1 
         SET @end = CHARINDEX(@delimiter, @string, @start)
         Set @Count = @Count+1
     END 
     RETURN 
  END
  </code></pre>
  
  <p>I know this code will return the string between 2 delimiters </p>
  
  <pre><code>substring( LEFT(@String, charindex(']', @String)-1), CHARINDEX('[', @String) + len('['), LEN(@String)) 
  </code></pre>
  
  <p>is there any way to combine the 2 and return the required output?</p>
  
  <p>Thanks</p>