如何将记事本++中的3级线转换为csv

时间:2018-07-30 22:20:21

标签: regex notepad++

我有超过30000条记录。都一样。

我想要这种格式:

parent::name::description::slug

example:Uncategorized::New Category::This category is new::new-category

文件如下:

Chocolate, Biscuits & Sweets

Bakery & Confectionery

Chocolate



Chocolate, Biscuits & Sweets

Bakery & Confectionery

Gum



Chocolate, Biscuits & Sweets

Bakery & Confectionery

Candy Toys



Chocolate, Biscuits & Sweets::Bakery & Confectionery::::Bakery-Confectionery    // this is subcategory of category Chocolate, Biscuits ...


Bakery & Confectionery::Chocolate::::Chocolate    // this is subcategory of subcategory

Bakery & Confectionery::Gum::::Gum    // this is subcategory of subcategory

Bakery & Confectionery::Candy Toys::::Candy-Toys    // this is subcategory of subcategory

可以在记事本++中使用正则表达式吗?

1 个答案:

答案 0 :(得分:1)

如果我正确理解了您的问题,则可以在记事本++中进行此操作:

查找:(.*)[\r\n]+(.*)[\r\n]+(.*)[\r\n]+

替换为:$1::$2::::$3\r\n

获取示例数据:

Chocolate, Biscuits & Sweets

Bakery & Confectionery

Chocolate

Chocolate, Biscuits & Sweets

Bakery & Confectionery

Gum

Chocolate, Biscuits & Sweets

Bakery & Confectionery

Candy Toys

输出为:

Chocolate, Biscuits & Sweets::Bakery & Confectionery::::Chocolate
Chocolate, Biscuits & Sweets::Bakery & Confectionery::::Gum
Chocolate, Biscuits & Sweets::Bakery & Confectionery::::Candy Toys