-5

What I have:

String result = "<>hello<!><>Soumik<!><>Having a wonderful day?<!>";

What I need:

resultStrings = ["hello", "Soumik", "Having a wonderful day?"];
nicael
  • 17,612
  • 12
  • 55
  • 87

2 Answers2

1

This regex should do the trick:

<[^>]*>([^<]+)<

Find all matches, and extract capturing group 1 from each.

Regex demo

James Buck
  • 1,610
  • 8
  • 13
0

How about that:

result = result.replace("<", "");
result = result.replace(">","";
resultStrings = result.split("!");

It's really simple.

I don't know other conditions so it may not be useful. Please add conditions so I can respond to it.

nicael
  • 17,612
  • 12
  • 55
  • 87
Spitzbueb
  • 4,434
  • 1
  • 20
  • 37