PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: oasis-open/cti-stix-validator (python)

Issue:
Seeing error w/ indicator w/ a pattern
With the attached file, I see:
[X] Fatal Error: expected string or buffer

It appears that it is trying to parse/understand the pattern, but it fails.
[test.txt](https://github.com/oasis-open/cti-stix-validator/files/1154374/test.txt)

This is at 63a339b75caf65b7ec4e13d13f073f5b4a29b60b.

A previous version of the validator was known to work properly on a similar indicator w/ a pattern.  I don't remember what version that was.



Pull request:
Fix patterning bugs
- one caused by recent pattern-validator update
- one caused by backslashes

Close #29.

Patch:
diff --git a/stix2validator/musts.py b/stix2validator/musts.py
index 4f04150..4afc50a 100644
--- a/stix2validator/musts.py
+++ b/stix2validator/musts.py
@@ -383,8 +383,7 @@ def patterns(instance, options):
         for exp in expression_list:
             path = exp[0]
             # Get the property name without list index, dictionary key, or referenced object property
-            prop_matches = re.match('([^\.\[]+)(\[\.+\])?(\..+)?', path)
-            prop = prop_matches.group(1)
+            prop = path[0]
             if objtype in enums.OBSERVABLE_PROPERTIES and prop in enums.OBSERVABLE_PROPERTIES[objtype]:
                 continue
             elif options.strict_types:


Test patch:
diff --git a/stix2validator/test/indicator_tests.py b/stix2validator/test/indicator_tests.py
index f3f2131..4318494 100644
--- a/stix2validator/test/indicator_tests.py
+++ b/stix2validator/test/indicator_tests.py
@@ -170,6 +170,11 @@ class IndicatorTestCases(ValidatorTest):
         indicator['pattern'] = """[windows-registry-key:values[*].data='badstuff']"""
         self.assertTrueWithOptions(json.dumps(indicator))
 
+    def test_pattern_with_escaped_slashes(self):
+        indicator = copy.deepcopy(self.valid_indicator)
+        indicator['pattern'] = "[windows-registry-key:key LIKE 'HKEY_LOCAL_MACHINE\\\\Foo\\\\Bar%']"
+        self.assertTrueWithOptions(json.dumps(indicator))
+
 
 if __name__ == "__main__":
     unittest.main()