Repository: sqlfluff/sqlfluff

Issue:
DbUp style variables support
### Search before asking

- [x] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.


### Description

Support DbUp style variables in placeholder without writing regex

### Use case

As a DbUp user I'd like to use both tools on same code

### Dialect

no

### Are you willing to work on and submit a PR to address the issue?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)

Hints from issue comments:

Solution patch:
diff --git a/docs/source/configuration/templating/placeholder.rst b/docs/source/configuration/templating/placeholder.rst
index 3dcc9389a..a060dba3d 100644
--- a/docs/source/configuration/templating/placeholder.rst
+++ b/docs/source/configuration/templating/placeholder.rst
@@ -50,6 +50,9 @@ A few common styles are supported:
     -- dollar
     WHERE bla = $my_name or WHERE bla = ${my_name}
 
+    -- dollar_surround (DbUp compatible variable)
+    WHERE bla = $my_name$
+
     -- question_mark
     WHERE bla = ?
 
diff --git a/src/sqlfluff/core/templaters/placeholder.py b/src/sqlfluff/core/templaters/placeholder.py
index 523725131..94d58d71d 100644
--- a/src/sqlfluff/core/templaters/placeholder.py
+++ b/src/sqlfluff/core/templaters/placeholder.py
@@ -41,6 +41,10 @@ KNOWN_STYLES = {
     "dollar": regex.compile(
         r"(?<![:\w\x5c])\${?(?P<param_name>[\w_]+)}?", regex.UNICODE
     ),
+    # e.g. WHERE bla = $name$ (DbUp compatible)
+    "dollar_surround": regex.compile(
+        r"(?<![:\w\x5c])\$(?P<param_name>[-\w]+)\$", regex.UNICODE
+    ),
     # e.g. USE ${flyway:database}.schema_name;
     "flyway_var": regex.compile(r"\${(?P<param_name>\w+[:\w_]+)}", regex.UNICODE),
     # e.g. WHERE bla = ?


Test patch:
diff --git a/test/core/templaters/placeholder_test.py b/test/core/templaters/placeholder_test.py
index ec50af668..8d6119ff1 100644
--- a/test/core/templaters/placeholder_test.py
+++ b/test/core/templaters/placeholder_test.py
@@ -266,6 +266,25 @@ def test__templater_raw():
                 "90": "'2020-10-01'",
             },
         ),
+        (
+            """
+            SELECT user_mail, city_id
+            FROM users_data
+            WHERE user_mail = '$12$'
+            AND date > $90$
+            """,
+            "dollar_surround",
+            """
+            SELECT user_mail, city_id
+            FROM users_data
+            WHERE user_mail = 'test@example.com'
+            AND date > '2020-10-01'
+            """,
+            {
+                "12": "test@example.com",
+                "90": "'2020-10-01'",
+            },
+        ),
         (
             """
             SELECT user_mail, city_id
@@ -345,6 +364,7 @@ def test__templater_raw():
         "numeric_dollar",
         "numeric_dollar_with_braces",
         "numeric_dollar_with_braces_and_string",
+        "dollar_surround",
         "percent",
         "ampersand",
         "flyway_var",