Thanks for your help Joseph. You have to understand that I am implementing two graduate programming classes in moodle 1.9, so right now, testing out your code in 2.6.2 is not the highest priority. I will get to it as the semester dies down.
You made a nice regex utility. I think I can offer some changes to the documentation that would improve it, later.
For now, if you are trying to create a matcher for an answer, the last thing in the world you would want to do is require the user to type "it's" as a first word. In fact, I would think anyone would want to ignore any such waste verbiage and focus on the core words.
You seem to have misunderstood my question. I was asking whether your permutation operator would match surrounding words.
You seem to indicate that this:
[ [ _blue_ _white_ _red _ ] ]
turns into this:
^[ [ _blue_ _white_ _red _ ] ]$
which would be good for disallowing the user to add in other colors by guessing them all.
Of course, if you got rid of the anchors, the pattern would match:
it's red white blue!
it is red white and blue, final answer
but it would also match:
I think it's orange red white blue red green yellow pink
So there are advantages to allowing anything on either side, but also disadvantages
I personally would like a permutation list and a list of words that are incorrect, but that goes beyond regex into a hashmap. But then again you have already done a permutation. This is not a specific syntax recommendation, just highlighting what would be useful
[ [ _blue_ _white_ _red _ ] ] :BADWORDS=orange,green.yellow,black
The reason I was surprised you use parentheses, aside from the fact I find them harder to see, is that they tend to be used to store values in regex engines.
I asked whether you support \s for space, and you didn't mention it? Or in your simplified regex are you already turning every space into \s+
I would like to write things like:
p = new\s+int\s*[\s*rows\s*\*\s*cols\s*];
Since that's a little awkward to type, I would love some notation that simplifies it. If a space means \s+ in your simplified version, I just need something simple that means "zero or more spaces".
CLOZE is not the most convenient syntax to type, but I quickly banged out a web page that lets me edit text and quickly substitute specific values for CLOZE expressions. It's a bit of a hack, but hopefully someday I can use it in moodle, it's way more convenient than the manual way i use now. I am sure I could do the same type of front end for a regex so that I wouldn't have to type \s+ and \s* (or [ \t]+ and [ \t]* if you don't support \s). What I need is access to the full regex, not a restricted subset. I will take another look at your documentation when I get the chance.