简体   繁体   English

在CSV档案上使用regex和notepad ++选择名字和姓氏

[英]Select first and last name using regex and notepad++ on a csv file

I have a list of our clients in an CSV file. 我在CSV文件中列出了我们的客户列表。

Each line have the phone number, full name, e-mail and birth date. 每行都有电话号码,全名,电子邮件和生日。 All separated by semicolon. 全部用分号分隔。 Each line looks like this: 每行看起来像这样:

000000000;Client Full Name;client@email.com;1983-12-27;

I want to use notepad++ and regex to change all the names from full name to just the first and the last. 我想使用notepad ++和regex将所有名称从全名更改为仅第一个和最后一个。

The final result should be something like this for all clients: 对于所有客户,最终结果应该是这样的:

000000000;Client Name;client@email.com;1983-12-27;

Can anyone help me with the regex code please? 有人可以帮我提供正则表达式代码吗?

Thanks 谢谢

You can use the following to match: 您可以使用以下内容进行匹配:

(;\w+)\s+\w+(\s+\w+;)

And replace with the following: 并替换为以下内容:

\1\2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM