-5

What I have:

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

What I need:

resultStrings = ["hello", "Soumik", "Having a wonderful day?"];
nicael
  • 18,550
  • 13
  • 57
  • 90

2 Answers2

1

This regex should do the trick:

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

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

Regex demo

James Buck
  • 1,640
  • 9
  • 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
  • 18,550
  • 13
  • 57
  • 90
Spitzbueb
  • 5,233
  • 1
  • 20
  • 38