regex - Python- Regular expression to match" <textarea> </textarea> " and anything between them -


if text was

<textarea> xyz asdf qwr </textarea>

i'm trying write regular expression me extract text in bold.

so far have reached [(<textarea)][</textarea>)] capture tags haven't been able capture text in between 2 tags.

i tried [(<textarea)]+.[</textarea>)] , [[(<textarea)]+.[</textarea>)] isn't giving right results.

can please throw light on or share links me reach solution?

is there particular reason must use regular expression parse seems html? wouldn't it. see regex match open tags except xhtml self-contained tags best explanation.

this becomes simple if use beautifulsoup module, going far better @ parsing html (especially if messy html).

import bs4  f = open("test.html") soup = bs4.beautifulsoup(f)  textarea in soup.find_all('textarea'):     print textarea.get_text() 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -