|
发表于 2008-9-29 21:45:51
|
显示全部楼层
life is short - you need Python!
one stupid, but relative simple example- import re
- a = 'href="../03df0-03df5/05.pdf"'
- b = '/'
- print re.sub(b+re.split(b, a)[1], '', a)
复制代码
input
href="../03df0-03df5/05.pdf"
output
href="../05.pdf"
to search and replace all <a> tag from *.html, you need beautifulsoup for extra help.
soup = BeautifulSoup.findAll('a'), and then apply the regex rules on those found entries within a loop. |
|