re(正規表現)
match() ※先頭からの比較となる
import re
match = re.match('http.*'+hostname+'/(.*)/', https://hogehoge.com/wp/])
pathname = match.group(1)
print(pathname) ⇒ 「wp」
search() ※任意の位置からの比較なので、必要ならパターンに^や$が必要
import re
match = re.search("^(require.*)(wp-blog-header.*)$", l)
if match:
lines = match.group(1)+wp_dir_name+'/'+match.group(2)
置換
import re
b = re.sub('[\d_-]+( \(.*\))?(big)?\.jp.*$', '', file)