Regex input support?

Wondering if support for Regular Expression for input validation etc. might be something on the horizon.

Would be handy for string input automated feedback of sorts.

1 Like

Hey Mike, can you elaborate?


I’m picturing an open response question where I ask kids to maybe describe something and am looking for them to use certain key words. So, a regex that looks for that, or rather its opposite, can automate note updating to reflect whether they’ve used terminology I’m looking for.

So rather than check *.content for a literal string, make it more flexible to allow for all kinds of stuff but use regex logic to look for specific parts in that string.

Make sense?

1 Like

Makes sense. Not sure how we feel about machine grading student writing, but I’ll pass it on as a feature request!

Not grading just feedback. Issue right now being… while the written feedback feature is great it relies on:

  • student doing it live at the same time as a teacher is doing it
  • but can’t have too many students doing it live or else teacher can’t provide that feedback fast enough

The number one feedback we’ve received from students in learning from home is that they need a way to be able to do activities when and how they are able to access technology and yet still get that quality feedback as they’re doing it.

This would be a powerful way of providing that feedback in a less boolean fashion and encouraging reflective thought.

1 Like

This would be extremely useful for me for the reasons you mentioned. I’m having students do Desmos activities outside of class times and would like for them to get immediate feedback on their responses. I don’t really need something as powerful as regex, I think basic pattern matching or even just basic string methods would be a huge help.

1 Like

I agree that regex support would be a really powerful and useful feature. It would add more flexibility to the computation layer.

Are the pattern types listed in the CL documentation available and if so is there any example of how to create one? They look like they might be relevant.
I often want to check constraints on the form of a math expression in addition to functional correctness, for instance when the question is “express 5^(3/2) in radical notation” I don’t want an answer of 5^(3/2) to be treated as correct, I also want to check that the latex contains a sqrt somewhere. Same with questions about rewriting polynomials as a product of linear factors, in addition to checking functional equivalence (by evaluating at several points) against the original polynomial, I want to at least check that the response doesn’t contain a ^.

Not quite ready yet, but we’re working both on making them available and providing examples. We’ll post in the announcements section if/when it’s ready.


I would also like the Regex support. It looks like the pattern functions might work for me also. I am asking students to simplify an equation. I can check that they have the equation correct using xyline but I can’t make sure they don’t have two x or y terms in their version.

Thank you

Completely agree here, basic string functions will help, and again is not necessarily to grade the students but to give them feedback so we speed up the learning.

I am trying to get 2 vertical asymptotes in one single math input and I find it impossible.

Hi, Jay,

Has this been implemented yet? Was this implemented as Patterns?


To some degree, yes. Not exactly as it was described in the beginning of this thread but you should be able to parse basic expressions.

1 Like