Question: The title says it all. Just to add that the number can be multiple digits.

I'm using the following function:

```
str_replace( "/^\&DaysAgo=d+$/", "", $save_query);

```

Answer: 
For anyone else that has this issue that might be in the same way that I had it. I had the exact same problem, but not quite with the same stack traces as defined above. 

My problem was that I didn't have MongoDB installed/running, and that caused it to hang, throwing many errors in the logs. Doing a simple install and a couple setup commands with the pre-defined connection strings seemed to kick it into gear just fine.
Navigate to `inetpub\wwwroot\newsxa[Your file]\Website\App_Config\Include` 
where you will find `Sitecore.Xdb.config in line 8` 

```
<setting name="Xdb.Enabled" value="true" />

```

Just make it false

It will install after that.