[英]Notepad++ Search and Replace with Tab Delimited File
I have a file that is tab delimited.我有一个制表符分隔的文件。 When exporting from Excel, if the cell has a comma in it, it will wrap the cell with double quotes.
从 Excel 导出时,如果单元格中有逗号,它将用双引号将单元格括起来。
To find the first double quote, I can look for a tab then double quote ex: \\t"
要找到第一个双引号,我可以查找制表符,然后查找双引号,例如:
\\t"
The next double quote to remove is at the end of the line, so I would like to find double quote then newline ex: \\n"
but this is not working.要删除的下一个双引号在行尾,所以我想找到双引号然后换行符:
\\n"
但这不起作用。
Example of the file format:文件格式示例:
text
TAB text
TAB "moretextwithquotes"
CRLF text
TAB text
TAB "moretextwithquotes"
CRLF
First, you're searching for \\n"
instead of "\\n
, if I well understand your problem.首先,如果我很了解您的问题,您正在搜索
\\n"
而不是"\\n
。
Secondly, you need to search for \\r\\n
instead of \\n
, so your final result should be "\\r\\n
.其次,您需要搜索
\\r\\n
而不是\\n
,因此您的最终结果应该是"\\r\\n
。
If all your data is consistent where double quotes are matched and encapsulates fields,如果您的所有数据在双引号匹配和封装字段的位置一致,
I would just do a global find and replace just on quoted text.我只会做一个全局查找并替换引用的文本。
Replacing the match with just the field data.仅用字段数据替换匹配项。 This strips the quotes, leaves everything
这去掉了引号,留下了一切
else untouched.其他不变。
Find: "([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"
查找:
"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"
Replace: $1
更换:
$1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.