htmlファイル内で一致させようとしています。これはhtmlです:Pythonの正規表現がhtmlファイルで一致する
<td>
<b>BBcode</b><br />
<textarea onclick='this.select();' style='width:300px; height:200px;' />
[URL=http://someimage.com/LwraZS1] [IMG]http://t1.someimage.com/LwraZS1.jpg[/IMG][ [/URL] [URL=http://someimage.com/CDnuiST] [IMG]http://t1.someimage.com/CDnuiST.jpg[/IMG] [/URL] [URL=http://someimage.com/Y0oZKPb][IMG]http://t1.someimage.com/Y0oZKPb.jpg[/IMG][/URL] [URL=http://someimage.com/W2RMAOR][IMG]http://t1.someimage.com/W2RMAOR.jpg[/IMG][/URL] [URL=http://someimage.com/5e5AYUz][IMG]http://t1.someimage.com/5e5AYUz.jpg[/IMG][/URL] [URL=http://someimage.com/EWDQErN][IMG]http://t1.someimage.com/EWDQErN.jpg[/IMG][/URL]
</textarea>
</td>
[to]からすべてのBBコードを抽出します。
そして、これは私のコードです:
import re
x = open('/xxx/xxx/file.html', 'r').read
y = re.compile(r"""<td> <b>BBcode</b><br /><textarea onclick='this.select();' style='width:300px; height:200px;' />. (. *) </textarea> </td>""")
z = y.search(str(x())
print z
しかし、私はこれを実行したときに、私は間違いありなしオブジェクトを取得...?
は '')(読み括弧忘れました。 –
何もない、まだ何も取得..正規表現が間違っているかもしれません.. –
ええと、answer.checkを投稿しました。 –