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

This is inside of a test case for a class assignment. It seems that the test cases allow for JS inside since it references in the help. But I've tried every possible permutation of the regular expression to get the test case to work with no luck.

Edit: To clarify, I can't provide a Repl link because it's not on a project, it's about a feature of Repl itself.