Regular Expression NOT case insensitive

Regular Expression NOT case insensitive

by ben reynolds -
Number of replies: 2
Hi All,
I'll copy my Lesson Module Short Answer Regular Expression problem below. My problem is that Answer 1 refuses to be case insensitive, despite the "/i" on the end of the expression. So, if the correct answer is copied and pasted, fine. But if "during warmups before the game started" is typed in, the answer is incorrect.

(Astute readers will notice that I removed the second "the" from Answer 3 to solve a different problem.)

Text of the page:

Lesson 1 - Exercise 5 - Part B - Question 4

Identify the adverbials in this sentence.

During warmups, before the game started, the basketball team looked exhausted.

Copy and paste the adverbials into the text box. Be sure to keep the adverbials in the correct sequence from left to right. Keep a space between each word


Answer 1:
During warmups(,| ) before the game started(,| )/i
Response 1:
Yes, you identified all adverbials: During warmups and before the game started.

Answer 2:
--(during warm-ups)|(before the game started.*)
Response 2:
You did not include all the adverbials in sentence 4. Click the button and try again.

Answer 3:
++(basketball|team|looked|exhausted)
Response 3:
No. You've included more than the adverbials in sentence 4, which are the prepositional phrase During warmups and the subordinate clause before the game started.

Average of ratings: -
In reply to ben reynolds

Re: Regular Expression NOT case insensitive

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Ben,

The problem is not with case sensitive or not but with the formulation of your regular expression for the correct answer. Try this:

Answer 1:

During warmups(,|) before the game started/i

or this:

During warmups(,)? before the game started/i

There is no reason to include an optional comma at the end of the expected correct answer. Please be careful with the blank spaces too.

Joseph

In reply to Joseph Rézeau

Re: Regular Expression NOT case insensitive

by ben reynolds -
Joseph,
Thanks for your reply. This will make you throw your hands in the air. I realized also that people can either drag a space at the end of the word, or a comma, or nothing. And so, with some monkeying around, I got this to work.

During warmups(,| )(| )before the game started(,|)(| )/i

And it works for every variation I can throw at it. And it is case insensitive.

But I think your point is that the regular expression ends with the "d," so shouldn't care about the extra space. Still, I've had Moodle yell at me for putting an email address in a profile that had a space on the end.