[COMPASS-3130] Regular expression literals can't handle backslashes in agg builder Created: 17/Sep/18  Updated: 29/Oct/23  Resolved: 24/Mar/20

Status: Closed
Project: Compass
Component/s: Aggregation pipeline, Grammar
Affects Version/s: None
Fix Version/s: 1.22.0

Type: Bug Priority: Major - P3
Reporter: Anna Herlihy (Inactive) Assignee: Durran Jordan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes COMPASS-4146 Disable validation in agg builder, qu... Closed
Sprint: Iteration Zebra

 Description   

You can't escape backslashes in a regex literal in the agg builder, but the same regex in the query bar and shell work fine.

Example: /abc\/123/ will error in the agg builder but not the query. Workaround is to use the "RegExp" object with a string instead of a literal.



 Comments   
Comment by Brian Blevins [ 12/Jun/19 ]

The RegExp() workaround requires a double backslash in order to work properly in Compass 1.18.0.

"digit_field_name": RegExp("\\d+")

Generated at Wed Feb 07 22:32:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.