I have a very complex string, such as:
<p>aaa <font style="color:red">ABCD@@@EFG^&*))*T*^[][][]</p>
<p>bbb <font style="color:red">ABCD@@@EFG^&*))*T*^[][][]</p>
<p>ccc <font style="color:red">ABCD@@@EFG^&*))*T*^[][][]</p>
....
Now I want to get the aaa
,bbb
,ccc
parts. I don't want to use regular expression here, because it's too complicated to turn the <font style="color:red">ABCD@@@EFG^&*))*T*^[][][]</p>
part to a regex.
I hope there is a method (say substrings_between
), I can use it like this:
substrings = text.substrings_between('<p>', ' <font style="color:red">ABCD@@@EFG^&*))*T*^[][][]</p>');
substrings # -> [aaa, bbb, ccc]
Is there such a method? Or what's the best way to do?