I need to one give me the string between ~ and ^.
I have a string like this:
~~~~ ABC ^ DEF ^ HGK > LMN ^ I need to get the string between them with python.
I've tried this:
import re
target = ' ~~~~ ABC ^ DEF ^ HGK > LMN ^ '
matchObj = re.findall(r'~(.*?)\^', target)
print matchObj But the result is:['~~~ ABC '] What I expect is:
[ABC , DEF , HGK , LMN ] or
[^ABC , ^DEF , ^HGK , LMN ] I want to do all this because i am trying to extract text from an html page. like this example
<td class="cell-1">
~~~~ ABC ^ DEF ^ HGK > LMN ^
</td>