Reputation: 936
I'm using regex to look for answer choices and their descriptions. Until now it's working great, but the problem is that I can't figure out how to include multiple line description without including next Choice.
My current regex:
^(Choice [A-I] \(.*\) +(?:is incorrect. )?($|\r?.*))
Test cases:
Choice B (Predominance of eosinophils) zfdfdfbhdfdfdf
fgdfgdfgdfdfdfhd fgdfgdfgdsgsf
sgsgdfgdf gdfgdfgdfgdfgd gdfg
Choice C (Monosodium urate crystals) fghfdghfghfghfh
Choice D (Spirochetes) is incorrect fghfghfghfghfghf
Choice E (Predominance of polymorphonuclear cells)
I need the two random text sentences after Choice B to be also included in Choice B match, but without including Choice C.
Upvotes: 0
Views: 61
Reputation: 8174
You can try:
(Choice [A-I] \(.*\) )(((?!Choice)[^\n]+[\n]?)+)?
Explanation
(?!Choice)
: String don't beginning with "Choice"
[^\n]
: any letter, except "\n"
Upvotes: 1