Dear team,
I am reaching out in relation to the following doc:
https://cloud.google.com/chronicle/docs/reference/reference-lists
In the Regex lists section, there is an example of regex reference list content:
// This is a new line comment in a regex reference list.
.*chronicle.*
http:\/\/google\.com // This is an inline comment.
^[0-9].*\.gov$
// The line below is a potential problem. Everything after double forward slash is
// a comment, and is ignored.
http://website.com
The docs say that this reference list content parses into the regex content below:
.*chronicle.*
http://google\.com
^[0-9].*\.gov$
http:
However, i feel there are two errors.
1. In `http://google\.com`, why is there a `\` before the `. `
The `.` has been escaped with a backslash `\`. And therefore, the parsed content should be: `http://google.com`
2. In `^[0-9].*\.gov$`, the `.` is escaped by a `\`. And so the parsed content should be: `^[0-9].*.gov$`
Please let me know if i am thinking wrong about this.
You are correct that the \ ahead of the . is an escape character in both of those examples. While we could with just a dot, we would end up with a number of options os \. forces that statement to be .com in example 2 and .gov in example 3.
I think the point that was trying to be made in that section of the doc was really around the comment lines and the handling of the forward slashes. Because urls will often have forward slashes, the concern was how do those lines get represented v comments and what they are showing in the before and after is what the regex list would look like when comments are stripped out before the comparisons with the list occurs.
Hope that helps.