-2

I have a string like the following:

HELLO: blah blah WORLD: woo woo FOO: foo foo

I need to split this string into 3 strings e.g.

HELLO: blah blah 
WORLD: woo woo 
FOO: foo foo

I tried to find pattern around the [:] but didn't help a lot.

Thank you.

P.S. C# or VB.NET code it's irrelevant to me. Both of these will work for me. Thx again

Elizabeth Dimova
  • 255
  • 1
  • 3
  • 19

1 Answers1

2

You can try with :--

string[] substrings = Regex.Split("HELLO: blah blah WORLD: woo woo FOO: foo foo", "(\s(?=[A-Z]))");

split the input string by space followed by capital latter.

Shekhar Khairnar
  • 2,643
  • 3
  • 26
  • 44
  • Thank you, buddy. I didn't know that there are people who are here to help someone. Based on the downvotes and showing off a power i though that people come here to cure their frustrations. God bless you. – Elizabeth Dimova Jul 29 '16 at 10:38