我目前正在从2011年导出和修改我的数据库,以使用物理路径访问我的文件。我尝试使用正则表达式进行搜索(我使用Notepad ++编辑CSV导出)但是,我有一个问题,因为它没有找到我尝试的内容搜索。这是我数据库的一部分:
"1","blahblah","description","68 KB","2011-02-12 17:19:17","0000-00-00 00:00:00","2011-02-12_www_website_pl_filename.rar","x","x","1720","59","3612","1"
"2","blahblahb","description","146.25 KB","2011-02-13 00:13:06","0000-00-00 00:00:00","2011-04-19_www_website_pl_something.rar","x","x","2201","59","3613","1"
我想找到的是这部分:
"2011-04-19_www_website_pl_filename.rar"
并将其替换为以下内容:
"/home/public_html/website/files/2011-04-19_www_website_pl_filename.rar"
所以我试图将其视为正则表达式:
"[2011].*[_www_website_pl_].*"
不幸的是,它不起作用 - 这个表达式几乎可以找到所有的行。它有什么问题?我应该在"替换为"窗口,所以它只替换路径的开头?
答案 0 :(得分:0)
您可以使用以下内容进行匹配:
(?<=")(2011[^"]*?_www_website_pl_.*?)(?=")
并替换为
/home/public_html/website/files/\1