嗨,我正在研究这个正则表达式。
https://www.debuggex.com/r/giVfbILJPyJCk3Ti
适用于第二种情况
15. Sleep deprivation impairs our ability to
a) focus our attention
b) learn new information
c) transfer information to long-term memory
d) All of the above
Ans: d
但是对于第一种情况,问题中有\ n。如何在问题中跳过\ n
1. Which of the following
can be classified as learning?
a) Development of neural connections in the brain
b) Using crutches while your broken leg heals
c) Writing with your left hand while the right hand is injured
d) Acquisition of reading skills
Ans: d
答案 0 :(得分:1)
答案 1 :(得分:0)
您可以将换行符添加为选项(将[^\n]
更改为仅使用.
修饰符的/s
),然后制作问题吞噬量词{{1}它的非贪婪变种+
:
+?
请注意,Debuggex似乎在图表中以相同的方式呈现([ \t]*\d+\..+?\n(?:[ \t]*[a-zA-Z]\)[^\n]+\n)+[\s]*Ans:[^\n]*)
和.
,但它们的含义却截然不同。