Chapter 3: Core Aggregation - Combining Information Lab - $group and Accumulators

In this lab, I get the wrong answer for the deviation.
I checked the answer and I noticed that it is considering in match “Won \d{1,2} Oscars?” but it should be “Won \d{1,2} Oscar.*”. Hence there is bit deviation in the deviation result.

Please suggest me, if I am making any mistake?

excuse me, I can’t help with your question, but I wonder where to check the regular expressions syntax which u used here? for example I don’t understand what the slash before digit means and where to find some explanation on it. thanks in advance!

Well, I did not know about that. I assume Mongodb regex supports almost all the regexp syntax. For example,

\d - all digits
\s - white space,
\w - a word,
\S - no space,
\alpha - alpha character and so on.

HI,
/Oscars?/ is equivalent for this task to /Oscar.*/
/Oscars?/ = {/Oscar/ or /Oscars/} i.e. s? means “s” or nothing
/Oscar.*/ = /Oscar/ and any symbol after

so any of these should give the same results.

I guess the problem is in something else.

@ Mojammal_95771

Notice that “Oscars” does not match "Oscar ".

You don’t show your entire expression, but you may want to read or review the documentation on MongoDB’s use of PCRE here and the differences between the // notation and $regex. HTH.

Thanks. That explains a lot.

Regular expression is a vast topic. Unfortunately, mongoDB documentation page only touches the surface of Regexp. It would have been helpful if they would have reveled which regexp engine they used.