Repository: tobymao/sqlglot

Issue:
Incorrect treatment of dollar quoted signs in for regex patterns
In the docs you can see that [Dollar quoted string constants](https://docs.snowflake.com/en/sql-reference/data-types-text#dollar-quoted-string-constants) should work as follows for regex 

```
'regular expression with \\ characters: \\d{2}-\\d{3}-\\d{4}'
```

is equivalent to the following dollar quoted variant: 

```
$$regular expression with \ characters: \d{2}-\d{3}-\d{4}$$
```

However when using the dollar quoted variant, sqlglot converts the dollar quoted version incorrectly as follows: 

```
from sqlglot import parse_one

print(
    parse_one(
        "SELECT RLIKE(field, $$regular expression with \ characters: \d{2}-\d{3}-\d{4}$$, 'i') from log_source", read="snowflake"
    ).sql(dialect="snowflake", pretty=True)
)
```

Outputs:

```
SELECT
  REGEXP_LIKE(field, 'regular expression with \ characters: \d{2}-\d{3}-\d{4}', 'i')
FROM log_source
```


I would expect:

```
SELECT
  REGEXP_LIKE(field, 'regular expression with \\ characters: \\d{2}-\\d{3}-\\d{4}' 'i')
FROM log_source
```



Discussion:

Resolving patch:
diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
--- a/sqlglot/dialects/snowflake.py
+++ b/sqlglot/dialects/snowflake.py
@@ -297,9 +297,10 @@ def _parse_id_var(
             return super()._parse_id_var(any_token=any_token, tokens=tokens)
 
     class Tokenizer(tokens.Tokenizer):
-        QUOTES = ["'", "$$"]
+        QUOTES = ["'"]
         STRING_ESCAPES = ["\\", "'"]
         HEX_STRINGS = [("x'", "'"), ("X'", "'")]
+        RAW_STRINGS = ["$$"]
         COMMENTS = ["--", "//", ("/*", "*/")]
 
         KEYWORDS = {


Test patch:
diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py
--- a/tests/dialects/test_snowflake.py
+++ b/tests/dialects/test_snowflake.py
@@ -34,12 +34,21 @@ def test_snowflake(self):
         self.validate_identity("ALTER TABLE foo UNSET DATA_RETENTION_TIME_IN_DAYS, CHANGE_TRACKING")
         self.validate_identity("COMMENT IF EXISTS ON TABLE foo IS 'bar'")
         self.validate_identity("SELECT CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', col)")
+        self.validate_identity("REGEXP_REPLACE('target', 'pattern', '\n')")
         self.validate_identity(
             'COPY INTO NEW_TABLE ("foo", "bar") FROM (SELECT $1, $2, $3, $4 FROM @%old_table)'
         )
         self.validate_identity(
             "SELECT state, city, SUM(retail_price * quantity) AS gross_revenue FROM sales GROUP BY ALL"
         )
+        self.validate_identity(
+            r"SELECT RLIKE(a, $$regular expression with \ characters: \d{2}-\d{3}-\d{4}$$, 'i') FROM log_source",
+            r"SELECT REGEXP_LIKE(a, 'regular expression with \\ characters: \\d{2}-\\d{3}-\\d{4}', 'i') FROM log_source",
+        )
+        self.validate_identity(
+            r"SELECT $$a ' \ \t \x21 z $ $$",
+            r"SELECT 'a \' \\ \\t \\x21 z $ '",
+        )
 
         self.validate_all("CAST(x AS BYTEINT)", write={"snowflake": "CAST(x AS INT)"})
         self.validate_all("CAST(x AS CHAR VARYING)", write={"snowflake": "CAST(x AS VARCHAR)"})
@@ -385,13 +394,6 @@ def test_snowflake(self):
                 "snowflake": "SELECT 'a'",
             },
         )
-        self.validate_all(
-            r"SELECT $$a ' \ \t \x21 z $ $$",
-            write={
-                "snowflake": r"SELECT 'a \' \ \t \x21 z $ '",
-            },
-        )
-        self.validate_identity("REGEXP_REPLACE('target', 'pattern', '\n')")
         self.validate_all(
             "SELECT RLIKE(a, b)",
             write={