正则表达式从垂直排序到水平

时间:2018-04-28 10:41:55

标签: regex notepad++

如果你能帮助我节省大量时间,请提前感谢。

我的测试看起来像这样:

These questions refer to the audio file 001_TOEIC_part3.mp3

1). Where is the conversation taking place?

(A) In a church 

(B) In an office

(C) In a classroom

(D) In a park

2). What problem does the woman have?

(A) She will be late for work.

(B) She cannot make the meeting.

(C) She is struggling with her presentation.

(D) She worked late yesterday.

3). What does the man offer?

(A) To help

(B) To write her report

(C) To get coffee

(D) To make copies

These questions refer to the audio file 002_TOEIC_part3.mp3

1). What does the man plan to do?

(A) Have a party

(B) Buy office supplies

(C) Take a vacation

(D) Ask the woman out

2). Why does the man call the woman?

(A) To inquire about prices

(B) To sell her food

(C) To invite her to a party

(D) To order food and drinks

3). Where will the party be held?

(A) In a city park

(B) At the man's company

(C) On the beach

(D) In a theater

我希望他们看起来像这样:

These questions refer to the audio file 001_TOEIC_part3.mp3

1). Where is the conversation taking place?

(A) In a church (B) In an office (C) In a classroom (D) In a park

2). What problem does the woman have?

(A) She will be late for work. (B)  She cannot make the meeting. (C) She is struggling with her presentation. (D) She worked late yesterday.

3). What does the man offer?

(A) To help (B) To write her report (C) To get coffee (D)   To make copies

These questions refer to the audio file 002_TOEIC_part3.mp3

1). What does the man plan to do?

(A) Have a party (B) Buy office supplies (C) Take a vacation (D) Ask the woman out

2). Why does the man call the woman?

(A) To inquire about prices (B) To sell her food (C) To invite her to a party (D) To order food and drinks

3). Where will the party be held?

(A) In a city park (B) At the man's company (C) On the beach (D) In a theater

所以我想在Notepad ++中从(A)到(D)从垂直到水平排序答案选项。 每个音频文件有三个问题,每个问题有四个选项可供选择(A),(B),(C),(D) 源文件看起来与我在此处插入的文件完全相同。 我非常感谢任何帮助。 问候 阿隆

1 个答案:

答案 0 :(得分:1)

您可以尝试替换:

(?i)\s*[\n\r]+(?=\([BCD]\))

只需一个空格 As demonstrated on regex101.com

说明 -

代码替换所有出现的零或多个空格,后跟两个换行符或回车符(,B / C / D(不区分大小写,因此可以将它们保持小写:)),以及)有空格。

(?i)告诉正则表达式不区分大小写 \s*匹配零或多个空格
[\n\r]+匹配一个或多个换行符(基本上输入键)
(?=\([BCD]\))是一个积极的预测,与文字匹配,后跟(B/C/D) ,但与(B/C/D)部分不匹配。

注意 - 如果您有4个以上的选项,请考虑在正则表达式中将(?=\([BCD]\))更改为(?=\([B-Z]\))