Essay Regex

Hello,

can someone help with this query:

In using the essay interaction I have been trying the following regex in a keyword box

   /(ductless|glands|endocrine)(?:\W+\w+){1,7}?\W+(blood|release|secrete)/gi

I have tried it on https://regexr.com/ and it finds what I am looking for (one of the second set of words within 7 word distance of the first set.

This is my test sentence:

Endocrine glands are ductless glands of the endocrine system that secrete their products directly into the blood. 

Can someone explain why it doesn't work on my H5P Essay with the same text. I am using H5P in Wordpress.

 

Attachments: 
Content types: 
papi Jo's picture

Hi UlinkBio,

The Essay Keyword instructions say "Use a slash '/' at the beginning and the end to use a regular expression." You should not add "gi" after the final slash. I've tried your reg expression by removing that trailing "gi" and it does work.

However may I point out that relying on regular expressions to test student answers in such an "open-ended" environment as an essay is far from fool-proof. Your regular expression would accept as correct the following:

"Endocrine glands are sleeply glands of the endocrine computer that secrete their products directly into the blood."

Hi Papi Jo,

thanks a lot. I thought I'd tried it without the gi, but I guess I wasn't checking thoroughly. I know people can put in nonsense but that is the same as copying someone's homework. If somebody is inclined to do that, they'd probably do it with pen and paper as well. Anyway this isn't for any high stakes exams, it's more for a kind of blended formative assessment/feedback for writing concisely on a very specific 'closed-ended' topic e.g. 'describe the structure of the heart' that should include teacher and student discussion. Thanks for your input, I can finish these activities now before school starts - we're still gonna be online!

Hi 

   / (chem|signa|regula|cont|prod|trans)\w+(?:\W+\w+){0,7}?\W+(molecu|subst|stimu|inform)/

soI do have another question. I have tried the above regex which is supposed to find parts of the full word between 0 and 7 words apart. Again, it works fine on https://regexr.com/  but when I tried it on H5P https://h5p.org/node/993354 it doesn't seem to work. The test sentence was: " A hormone is any member of a class of signaling type molecules, produced by glands in ..."  Any ideas ?

Hi All,

could someone tell me what flavour of Regex is best for the H5P essay? For example I am trying to make some of my searches case insensitive but the "/i "  at the end of the statement does not work. Also, the selections for case insensitivity don't seem to work when regex statements are used. I have tried researching the issue but I am not sure what flavour to focus on.

Thanks.

otacke's picture

Hi!

You can use regular regular expressions, just modifiers are not supported.

Best,

Oliver