This way
Namespace
C#
using System.Text.RegularExpressions;
VB.Net
Imports System.Text.RegularExpressions
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
Regex regex = new Regex(@"[ ](?=(?:[^""]*""[^""]*"")*[^""]*$)", RegexOptions.Multiline);
string words = "abc xyz bb \"abc bcd\" dd";
string[] splits = regex.Split(words);
foreach (string s in splits)
{
Response.Write(s + "<br />");
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim regex As Regex = New Regex("[ ](?=(?:[^""]*""[^""]*"")*[^""]*$)", RegexOptions.Multiline)
Dim words As String = "abc xyz bb ""abc bcd"" dd"
Dim splits As String() = regex.Split(words)
For Each s As String In splits
Response.Write(s & "<br />")
Next
End Sub
Screenshot
Reference
stackoverflow.com