Skip to content
Are Regular Expressions in Test Cases for Class Assignments Working?
Profile icon

I am trying to use regular expressions in test cases and I am unable to get anything other than literal matching to work. Specifically, I am trying to check the output of:

print ("Hello World")

and I have set the regular expression to each of the following without success:

/Hello World/i
/Hello World/
new RegExp(/Hello World/i);

Is this functionality working and I am missing some documentation?

You are viewing a single comment. View All
Profile icon

Regular expressions don't work properly (or not at all). I've tried several variations, with/without start/end "/" markers as well as lots of others...all based on Mozilla ECMA regex, as referenced in your documentation.

I have noticed that if I put incorrect regex (i.e. invalid), the system will hang when running the test. So, it looks like it's running SOME kind of regex algo...but it's just very poorly implemented/documented.

Please fix this as it is a vital part of your platform for us instructors.

I've taken most of regex out, and will likely delete the specific test so it doesn't cause a failure for my students...but here's the link so that an admin can look at the assignment and run a test regex.

You can see, however, in the image below that it is treating the regex characters as least in how it's displaying output: