Repository: dbt-checkpoint/dbt-checkpoint (language: python)

Issue:
Regex Parsing Leads to Hanging Test
**Describe the bug**

When attempting to run `check-script-has-no-table-name`, the test can hang, potentially due to [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html). 

**To Reproduce**

I have yet to determine exact triggers but have spot-checked the regex and a test string both on [regex101.com](regex101.com) and in my dbt codebase.

String 1:
```
{#
test
#}

WITH source AS (
  SELECT *
  FROM {{ source('schema','table') }}
)
SELECT
, a
, b
FROM source
```
causes "catastrophic backtracking" and the test to hang when executed in my codebase

![Screen Shot 2021-12-17 at 6 12 19 PM](https://user-images.githubusercontent.com/29109322/146625706-53cc9e99-9e89-4b00-8c32-c1b3f78dc943.png)


but a string
```
{#
test
#}

WITH source AS (
  SELECT *
  FROM {{ source('schema','table') }}
)
SELECT
, a
FROM source
```
does not in both my codebase and regex101.com

![Screen Shot 2021-12-17 at 6 12 25 PM](https://user-images.githubusercontent.com/29109322/146625708-f2826b27-c1a5-4e27-8b94-a03195361be7.png)


**Expected behavior**

The regex to parse in a manner that doesn't cause the test to hang. 

**Version:**
v1.0.0

**Additional context**

This bug was introduced when the regex [here](https://github.com/offbi/pre-commit-dbt/blob/41003145b5cd67601fa0f3b6bb98ca3247543446/pre_commit_dbt/check_script_has_no_table_name.py#L13) was updated in [this commit](https://github.com/offbi/pre-commit-dbt/commit/65a38ad5a195a183722b98f77dce411a92c0e1c8) 




Discussion / hints:

Fix patch:
diff --git a/pre_commit_dbt/check_script_has_no_table_name.py b/pre_commit_dbt/check_script_has_no_table_name.py
index 451dd40d..55c6d049 100644
--- a/pre_commit_dbt/check_script_has_no_table_name.py
+++ b/pre_commit_dbt/check_script_has_no_table_name.py
@@ -10,7 +10,7 @@
 from pre_commit_dbt.utils import add_filenames_args
 
 REGEX_COMMENTS = (
-    r"((\/\*|\{#)([^*]|[\r\n]|([\*#]+([^*\/#]|[\r\n])))*(\*+\/|#\})|[ \t]*--.*)"
+    r"(?<=(\/\*|\{#))((.|[\r\n])+?)(?=(\*+\/|#\}))|[ \t]*--.*"
 )
 REGEX_SPLIT = r"[\s]+"
 IGNORE_WORDS = ["", "(", "{{"]  # pragma: no mutate


Test patch:
diff --git a/tests/unit/test_check_script_has_no_table_name.py b/tests/unit/test_check_script_has_no_table_name.py
index 43a8a785..397dac17 100644
--- a/tests/unit/test_check_script_has_no_table_name.py
+++ b/tests/unit/test_check_script_has_no_table_name.py
@@ -298,7 +298,7 @@ def test_replace_comments():
     sql = "--- select * from ee"
     assert replace_comments(sql) == ""
     sql = "/* select * from ee*/"
-    assert replace_comments(sql) == ""
+    assert replace_comments(sql) == "" or replace_comments(sql) == "/**/"
 
 
 def test_prev_cur_next_iter():