C
Codex Twin
Hello folks
I am trying to use regular expressions to achieve the following:
If my searchString is: "London Trains" Paris Amsterdam "Berlin Cars"
I want to be able to split this string by those grouped by the double
quotes first, and then the non-quoted words second. So for the above string,
I should get the following matches
"London Trains"
"Berlin Cars"
Paris
Amsterdam
Can this be achieved with a single regex?
My approach has been 3 step:
1. Match by word groups grouped in double quotes
2. Remove the words in the doubled quoted from the string
3. Regex.split the string by ' ' (single white space) to get an string array
of the remaining words (Paris and Amsterdam)
But my attempts have been dashed at 1 and 2.
I am even struggling to find a pattern that matches words in double quotes.
Any pointers would be greatly appreciated. I am using C#.
Thanks
I am trying to use regular expressions to achieve the following:
If my searchString is: "London Trains" Paris Amsterdam "Berlin Cars"
I want to be able to split this string by those grouped by the double
quotes first, and then the non-quoted words second. So for the above string,
I should get the following matches
"London Trains"
"Berlin Cars"
Paris
Amsterdam
Can this be achieved with a single regex?
My approach has been 3 step:
1. Match by word groups grouped in double quotes
2. Remove the words in the doubled quoted from the string
3. Regex.split the string by ' ' (single white space) to get an string array
of the remaining words (Paris and Amsterdam)
But my attempts have been dashed at 1 and 2.
I am even struggling to find a pattern that matches words in double quotes.
Any pointers would be greatly appreciated. I am using C#.
Thanks