I\'m new to regular expressions and would appreciate your help. I\'m trying to put together an expression that will split the example string using all spaces that are not s
If you are using c#, you can use
string input= "This is a string that \"will be\" highlighted when your 'regular expression' matches ";
List list1 =
Regex.Matches(input, @"(?\w+)|\""(?[\w\s]*)""|'(?[\w\s]*)'|<(?[\w\s]*)>").Cast().Select(m => m.Groups["match"].Value).ToList();
foreach(var v in list1)
Console.WriteLine(v);
I have specifically added "|<(?[\w\s]*)>" to highlight that you can specify any char to group phrases. (In this case I am using < > to group.
Output is :
This
is
a
string
that
will be
highlighted
when
your
regular expression
matches
something random