-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.4.9
-
Component/s: Querying
-
None
-
ALL
-
With a simple set of documents:
- {_id: 1, f1: "realapp"}
- {_id: 2, f1: "rea"}
- {_id: 3, f1: "rea\napp"}
- {_id: 4, f1: "rea\nlapp"}
- {_id: 5, f1: "suretrea"}
these two $regex expressions (identical except for use of quotes or slashes):
- find({f1:{$regex:'rea \n# comment 1\nl',$options:"x"}})
- find({f1:{$regex:/rea \n# comment 1\nl/,$options:"x"}})
give different results, both incorrect, despite our $regex documentation suggesting that the syntaxes with the search strings wrapped in quotes or slashes are equivalent.
Removing the option:x, the comment and the space leads to correct results from both forms.
- duplicates
-
SERVER-32356 Use of options:x and comments with $regex search including \n can lead to incorrect documents being returned
- Closed