带斜杠的单词组的正则表达式(Notepad ++)

时间:2017-01-12 17:03:27

标签: regex notepad++

我希望正则表达式能够像这样更改字符串:

chase away/out
deceased/departed family member
increase/multiply greatly
stupid/innocent-looking
small storeroom/shed/depot/cellar
make somebody extremely mad/angry
blur/cloud over/mist up completely
an/my honour

到这些

chase away|chase out
deceased family member|departed family member
increase greatly|multiply greatly
stupid-looking|innocent-looking
small storeroom|small shed|small depot|small cellar
make somebody extremely mad|make somebody extremely angry
blur completely|cloud over completely|mist up completely
an honour|my honour

在这些字符串之前可能存在以下字符:

 ,[that is SPACE and comma]
|
[TAB]

在这些字符串之后可能会有以下字符:

, [that is comma and SPACE]
|
[newline]

1 个答案:

答案 0 :(得分:0)

采取这一行:

blur/cloud over/mist up completely

正则表达式很难确定您期望

blur completely|cloud over completely|mist up completely

而不是

blur up completely|cloud over up completely|mist up completely

换句话说,up坚持mist而不是completely

要完成这项任务,你需要某种人工智能/自然语言处理能力(你能否机械地扩展这句话?)正则表达式在某种程度上不足以包含这些东西。